我突然打开了我的Django项目,当我尝试使用py manage.py runserver
启动它时,它给了我这个错误。
django.core.exceptions.ImproperlyConfigured: WSGI application 'invoice_project.wsgi.application' could not be loaded; Error importing module.
这是我的追溯。我检查了settings.py和wsgi.py文件,它们(我认为)都已正确配置,因此我不知道从哪里开始寻找错误
System check identified no issues (0 silenced).
August 02, 2019 - 07:33:17
Django version 2.2.4, using settings 'invoice_project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\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 "C:\Users\Enrico\Desktop\prova\django_invoice\invoice_project\invoice_project\wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\core\handlers\wsgi.py", line 135, in __init__
self.load_middleware()
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\core\handlers\base.py", line 35, in load_middleware
middleware = import_string(middleware_path)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\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 "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\livereload\middleware.py", line 13, in <module>
from livereload import livereload_port, livereload_host
ImportError: cannot import name 'livereload_port' from 'livereload' (C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\livereload\__init__.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Enrico\AppData\Local\Programs\Python\Python37\Lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\Enrico\AppData\Local\Programs\Python\Python37\Lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\core\management\commands\runserver.py", line 137, in inner_run
handler = self.get_handler(*args, **options)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\core\management\commands\runserver.py", line 64, in get_handler
return get_internal_wsgi_application()
File "C:\Users\Enrico\.virtualenvs\invoice_project-JDtH6-bZ\lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
) from err
django.core.exceptions.ImproperlyConfigured: WSGI application 'invoice_project.wsgi.application' could not be loaded; Error importing module.
点冻结输出:
astroid==2.2.5
backcall==0.1.0
beautifulsoup4==4.8.0
cairocffi==1.0.2
CairoSVG==2.4.0
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
colorama==0.4.1
cssselect2==0.2.1
decorator==4.4.0
defusedxml==0.6.0
Django==2.2.4
django-crispy-forms==1.7.2
django-debug-toolbar==2.0
django-livereload-server==0.3.2
django-node==4.0.0
django-webpack==3.1.1
django-webpack-loader==0.6.0
django-wkhtmltopdf==3.2.0
djangorestframework==3.10.2
html5lib==1.0.1
idna==2.8
ipython==7.7.0
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.14.1
lazy-object-proxy==1.4.1
livereload==2.6.1
Markdown==3.1.1
mccabe==0.6.1
mysql==0.0.2
mysqlclient==1.4.2.post1
optional-django==0.1.0
parso==0.5.1
pickleshare==0.7.5
Pillow==6.1.0
prompt-toolkit==2.0.9
pycparser==2.19
Pygments==2.4.2
pylint==2.3.1
PyPDF2==1.26.0
Pyphen==0.9.5
pytz==2019.2
reportlab==3.5.23
requests==2.22.0
six==1.12.0
soupsieve==1.9.2
sqlparse==0.3.0
tinycss2==1.0.2
tornado==6.0.3
traitlets==4.3.2
typed-ast==1.4.0
urllib3==1.25.3
wcwidth==0.1.7
WeasyPrint==48
webencodings==0.5.1
wrapt==1.11.2
xhtml2pdf==0.2.3
答案 0 :(得分:0)
您似乎缺少依赖性livereload
您可以使用
将其安装在您的应用程序虚拟环境中pip install livereload
如果您要删除依赖项,请从@Ivan的建议,以启动应用程序而无需实时重新加载。