【发布时间】:2021-11-28 22:32:05
【问题描述】:
我将我的 django 网络上传到 pythonanywhere,但每次运行该网站时,它都会显示 Error running WSGI application, ModuleNotFoundError: No module named 'AlertTraceWebsite'。我想我在 pythonanywhere 上错误地设置了目录,但不知道我做错了哪些步骤。任何帮助将不胜感激。谢谢。
我有一个这样的网址(项目可以找到here):
我的 pythonanywhere wsgi:
import os
import sys
path = os.path.expanduser('~/kabiboy/atportal')
if path not in sys.path:
sys.path. insert(0, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'AlertTraceWebsite.settings'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler (get_wsgi_application())
错误:
2021-10-09 07:27:34,383: Error running WSGI application
2021-10-09 07:27:34,384: ModuleNotFoundError: No module named 'AlertTraceWebsite'
2021-10-09 07:27:34,384: File "/var/www/kabiboy_pythonanywhere_com_wsgi.py", line 10, in <module>
2021-10-09 07:27:34,384: application = StaticFilesHandler (get_wsgi_application())
2021-10-09 07:27:34,384:
2021-10-09 07:27:34,385: File "/home/kabiboy/.virtualenvs/venv/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2021-10-09 07:27:34,385: django.setup(set_prefix=False)
2021-10-09 07:27:34,385:
2021-10-09 07:27:34,385: File "/home/kabiboy/.virtualenvs/venv/lib/python3.9/site-packages/django/__init__.py", line 19, in setup
2021-10-09 07:27:34,385: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2021-10-09 07:27:34,385:
2021-10-09 07:27:34,385: File "/home/kabiboy/.virtualenvs/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
2021-10-09 07:27:34,385: self._setup(name)
2021-10-09 07:27:34,385:
2021-10-09 07:27:34,385: File "/home/kabiboy/.virtualenvs/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
2021-10-09 07:27:34,386: self._wrapped = Settings(settings_module)
2021-10-09 07:27:34,386:
2021-10-09 07:27:34,386: File "/home/kabiboy/.virtualenvs/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
2021-10-09 07:27:34,386: mod = importlib.import_module(self.SETTINGS_MODULE)
2021-10-09 07:27:34,386: ***************************************************
2021-10-09 07:27:34,386: If you're seeing an import error and don't know why,
2021-10-09 07:27:34,386: we have a dedicated help page to help you debug:
2021-10-09 07:27:34,386: https://help.pythonanywhere.com/pages/DebuggingImportError/
2021-10-09 07:27:34,387: ***************************************************
【问题讨论】:
标签: python django pythonanywhere