После выполнения шагов, описанных в документации, у меня возникла следующая ошибка при попытке запустить «python Manage.py runserver». '.
Код: Выделить всё
C:\Users\Bence\Documents\Programozás-tanulás\web50\final project\benefactum>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\core\management\commands\runserver.py", line 115, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\core\management\__init__.py", line 381, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\Bence\AppData\Roaming\Python\Python310\site-packages\django\apps\config.py", line 300, in import_models
self.models_module = import_module(models_module_name)
File "C:\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Python310\lib\site-packages\corsheaders\models.py", line 4, in
from .signals import check_request_enabled # noqa
File "C:\Python310\lib\site-packages\corsheaders\signals.py", line 5, in
check_request_enabled = django.dispatch.Signal(
TypeError: Signal.__init__() got an unexpected keyword argument 'providing_args'
- Установил его из pip (pip install django- cors-headers)
- Я добавил «corsheaders» в INSTALLED_APPS (в settings.py)
- Добавление «corsheaders.middleware.CorsMiddleware» , «django.middleware.common.CommonMiddleware» в MIDDLEWARE (в settings.py, поместив их как можно выше, как указано в рекомендации документа)
- Добавлен CORS_ALLOW_ALL_ORIGINS = True
Подробнее здесь: https://stackoverflow.com/questions/706 ... rs-headers