Problem Description: run Python project with pychart and report an error: django.core.exceptions.ImproperlyConfigured: WSGI application ‘WebTool.wsgi.application’ could not be loaded; Error importing module.
See the following for complete error reporting:
D:\Python\project\WebTool>python manage.py runserver 0.0.0.0:8080
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
June 27, 2022 - 09:14:42
Django version 3.2.13, using settings 'WebTool.settings'
Starting development server at http://0.0.0.0:8080/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\Python\project\WebTool\WebTool\wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheaders'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "C:\Users\ext.azhang\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
) from err
django.core.exceptions.ImproperlyConfigured: WSGI application 'WebTool.wsgi.application' could not be loaded; Error importing module.
Solution: WSGI module needs to be installed
pip install django-cors-headers
Reuse command python manage.py runserver 0.0.0.0:8080
to run the project after installation
After successful operation, see the figure below
Read More:
- Django WSGI protocol application, based on wsgiref module DIY a web framework
- [Solved] django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.Did you install mysqlclie
- [Solved] Django.core.exceptions.ImproperlyConfigured: SQLite 3.9.0 or later is required (found 3.7.17).
- [Solved] Django Error: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
- Django Issues: TypeError: “Settings” object is irreversible
- [Solved] RuntimeError: No application found. Either work inside a view function or push an application contex
- [Solved] Django project locally Open Error: importerror: couldn’t import Django
- [Solved] Flask Application Context Error: RuntimeError: Working outside of application context.
- [Solved] Python Django error: error: (1146, “Table ‘mydb.django_session’ doesn’t exist”)
- [Solved] from django.core.cache import cache Error
- Python: Django exception when executing migrate operation: django.db.utils.OperationalError: (1051, “Unknown table’xxx’”)
- The anaconda-navigator interface cannot be started, loading application, report ERROR download_api._get_url error
- Python automatically generates the requirements file for the current project
- [Solved] Django Configurate celery error: django.db.utils.DatabaseError
- Python exports the gitlab project
- Python Error aiohttp.client_exceptions.ClientConnectorCertificateError, Cannot connect to host:443
- Django PythonConsole error: Requested setting DEFAULT_INDEX_TABLESPACE
- Python ImportError: numpy.core.multiarray failed to import
- [Solved] Python Project Import Module Error: ModuleNotFoundError
- Python asynchronous co process crawler error: [aiohttp. Client]_ Exceptions: serverdisconnected error: Server Disconnected]