[英]Error running WSGI application in Pythonanywhere
I have researched a lot and found this is a very common question.我研究了很多,发现这是一个非常普遍的问题。 But the fact is I believe somehow pythonanywhere can not detect my
settings.py
file.但事实是我相信 pythonanywhere 无法检测到我的
settings.py
文件。 Moreover, I have checked with the settings file directory and it is the same path as I have input in the WSGI file.此外,我检查了设置文件目录,它与我在 WSGI 文件中输入的路径相同。 I have also installed the required pip files but still getting the same errors.
我还安装了所需的 pip 文件,但仍然出现相同的错误。
Error running WSGI application
ModuleNotFoundError: No module named 'widget_tweaks'
File "/var/www/ewallet_pythonanywhere_com_wsgi.py", line 33, in <module>
application = get_wsgi_application()
File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/ewallet/.virtualenvs/myenv/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
Here is the wsgi.py这是wsgi.py
import os
import sys
path = '/home/ewallet/E-wallet/ewallet/ewallet/'
if path not in sys.path:
sys.path.append(path)
from django.core.wsgi import get_wsgi_application
os.environ['DJANGO_SETTINGS_MODULE'] = 'ewallet.settings'
application = get_wsgi_application()
Here is the directory image这是目录图像
Kindly help me to find the bug here.请帮我在这里找到错误。 Thank you
谢谢
You just entered path incorrectly.您刚刚输入的路径不正确。 It should be as following:
它应该如下所示:
path = '/home/ewallet/E-wallet/ewallet
So, correct version of your wsgi.py is as following:因此,您的 wsgi.py 的正确版本如下:
import os
import sys
path = '/home/ewallet/E-wallet/ewallet/ewallet/'
if path not in sys.path:
sys.path.append(path)
from django.core.wsgi import get_wsgi_application
os.environ['DJANGO_SETTINGS_MODULE'] = 'ewallet.settings'
application = get_wsgi_application()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.