简体   繁体   English

在 Pythonanywhere 中运行 WSGI 应用程序时出错

[英]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.

相关问题 运行WSGI应用程序Pythonanywhere Wagtail应用程序时出错 - Error running WSGI application Pythonanywhere Wagtail application 在 pythonanywhere 中运行 WSGI 应用程序时出错 - Error running WSGI application, within pythonanywhere 运行 WSGI 应用程序时出错 ModuleNotFoundError: No module named &#39;f_worldSHop&#39; File &quot;/var/www/fworld_pythonanywhere_com_wsgi.py&quot; - Error running WSGI application ModuleNotFoundError: No module named 'f_worldSHop' File "/var/www/fworld_pythonanywhere_com_wsgi.py" 在 PythongAnywhere 上运行 WSGI 应用程序时出错 - Getting Error when Running WSGI Application on PythongAnywhere 尝试使用 PythonAnyWhere 部署 Web Flask 应用程序时出现 WSGI 错误 - WSGI Error when Trying to Deploy Web Flask App with PythonAnyWhere 运行 WSGI 应用程序时出错:ModuleNotFoundError:没有名为“_overlapped”的模块 - Error running WSGI application: ModuleNotFoundError: No module named '_overlapped' 运行WSGI应用程序时出错,ModuleNotFoundError:没有名为“ mysite”的模块 - Error running WSGI application , ModuleNotFoundError: No module named 'mysite' 运行 WSGI 应用程序时出错 - client_secrets.json - Error Running WSGI application - client_secrets.json PythonAnywhere ImportError:没有名为wsgi的模块 - PythonAnywhere ImportError: No module named wsgi 在 pythonanywhere 设置 wsgi.py - Setup wsgi.py at pythonanywhere
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM