Skip to content

ModuleNotFoundError: No module named 'corsheader' #3

Open
@Ephraim67

Description

@Ephraim67

Hello Tim, I have installed "coresheader" even added it to the setting.py file but i am still having issues.
I can't run server

Snippet of the error code:

python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\servers\basehttp.py", line 48, in get_internal_wsgi_application
return import_string(app_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 15, in cached_import
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init_.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\Ephraim67\Rise\Backend\Backend\wsgi.py", line 16, in
application = get_wsgi_application()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\handlers\wsgi.py", line 118, in init
self.load_middleware()
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 15, in cached_import
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheader'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\management\commands\runserver.py", line 139, in inner_run
handler = self.get_handler(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
handler = super().get_handler(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\management\commands\runserver.py", line 78, in get_handler
return get_internal_wsgi_application()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: WSGI application 'Backend.wsgi.application' could not be loaded; Error importing module.
pipenv : The term 'pipenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • pipenv uninstall corsheaders
  •   + CategoryInfo          : ObjectNotFound: (pipenv:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

(env) PS C:\Users\Ephraim67\Rise\Backend> pip uninstall corsheaders
WARNING: Skipping corsheaders as it is not installed.
pipenv : The term 'pipenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
At line:1 char:1

  • pipenv run pip list
  •   + CategoryInfo          : ObjectNotFound: (pipenv:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

(env) PS C:\Users\Ephraim67\Rise\Backend> pip run pip list
ERROR: unknown command "run"
(env) PS C:\Users\Ephraim67\Rise\Backend> pip list
Package Version


asgiref 3.8.1
Django 5.0.6
django-cors-headers 4.3.1
djangorestframework-simplejwt 5.3.1
pip 24.0
psycopg2-binary 2.9.9
PyJWT 2.8.0
python-dotenv 1.0.1
sqlparse 0.5.0
tzdata 2024.1
Requirement already satisfied: django-cors-headers in c:\users\ephraim67\rise\env\lib\site-packages (4.3.1)
Requirement already satisfied: asgiref>=3.6 in c:\users\ephraim67\rise\env\lib\site-packages (from django-cors-headers) (3.8.1)
Requirement already satisfied: Django>=3.2 in c:\users\ephraim67\rise\env\lib\site-packages (from django-cors-headers) (5.0.6)
Requirement already satisfied: sqlparse>=0.3.1 in c:\users\ephraim67\rise\env\lib\site-packages (from Django>=3.2->django-cors-headers) (0.5.0)Requirement already satisfied: tzdata in c:\users\ephraim67\rise\env\lib\site-packages (from Django>=3.2->django-cors-headers) (2024.1)
(env) PS C:\Users\Ephraim67\Rise\Backend> pip install corsheaders
ERROR: Could not find a version that satisfies the requirement corsheaders (from versions: none)
ERROR: No matching distribution found for corsheaders
(env) PS C:\Users\Ephraim67\Rise\Backend> python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\servers\basehttp.py", line 48, in get_internal_wsgi_application
return import_string(app_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 15, in cached_import
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init_.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\Ephraim67\Rise\Backend\Backend\wsgi.py", line 16, in
application = get_wsgi_application()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\handlers\wsgi.py", line 118, in init
self.load_middleware()
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 15, in cached_import
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheader'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\management\commands\runserver.py", line 139, in inner_run
handler = self.get_handler(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 31, in get_handler
handler = super().get_handler(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\management\commands\runserver.py", line 78, in get_handler
return get_internal_wsgi_application()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
raise ImproperlyConfigured(
(env) PS C:\Users\Ephraim67\Rise\Backend> rm Pipfile.lock
At line:1 char:1

  • rm Pipfile.lock
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\Ephrai...nd\Pipfile.lock:String) [Remove-Item], ItemNotFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
    
    

(env) PS C:\Users\Ephraim67\Rise\Backend> pip unistall install django-cors-headers
(env) PS C:\Users\Ephraim67\Rise\Backend> pip uninstall django-cors-headers
Found existing installation: django-cors-headers 4.3.1
Uninstalling django-cors-headers-4.3.1:
Would remove:
c:\users\ephraim67\rise\env\lib\site-packages\corsheaders*
c:\users\ephraim67\rise\env\lib\site-packages\django_cors_headers-4.3.1.dist-info*
Proceed (Y/n)? y
Successfully uninstalled django-cors-headers-4.3.1
(env) PS C:\Users\Ephraim67\Rise\Backend> pip install django-cors-headers
Using cached django_cors_headers-4.3.1-py3-none-any.whl.metadata (16 kB)
Requirement already satisfied: asgiref>=3.6 in c:\users\ephraim67\rise\env\lib\site-packages (from django-cors-headers) (3.8.1)
Requirement already satisfied: Django>=3.2 in c:\users\ephraim67\rise\env\lib\site-packages (from django-cors-headers) (5.0.6)
Requirement already satisfied: sqlparse>=0.3.1 in c:\users\ephraim67\rise\env\lib\site-packages (from Django>=3.2->django-cors-headers) (0.5.0)Requirement already satisfied: tzdata in c:\users\ephraim67\rise\env\lib\site-packages (from Django>=3.2->django-cors-headers) (2024.1)
Using cached django_cors_headers-4.3.1-py3-none-any.whl (12 kB)
Installing collected packages: django-cors-headers
Successfully installed django-cors-headers-4.3.1
(env) PS C:\Users\Ephraim67\Rise\Backend> python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\servers\basehttp.py", line 48, in get_internal_wsgi_application
return import_string(app_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 15, in cached_import
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init_.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\Ephraim67\Rise\Backend\Backend\wsgi.py", line 16, in
application = get_wsgi_application()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\handlers\wsgi.py", line 118, in init
self.load_middleware()
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\module_loading.py", line 15, in cached_import
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheader'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\management\commands\runserver.py", line 139, in inner_run
handler = self.get_handler(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 31, in get_handler
handler = super().get_handler(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\management\commands\runserver.py", line 78, in get_handler
return get_internal_wsgi_application()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ephraim67\Rise\env\Lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: WSGI application 'Backend.wsgi.application' could not be loaded; Error importing module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions