简体   繁体   English

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

[英]Error running WSGI application, within pythonanywhere

Good day to all,祝大家有个美好的一天,

I was having some issues trying to host my django webapp within pythonanywhere and I keep getting the following errors within the server.我在尝试在 pythonanywhere 中托管我的 django webapp 时遇到了一些问题,我在服务器中不断收到以下错误。 Sorry in advance I'm a beginner when it comes to programming提前抱歉,我是编程的初学者

WSGI File: WSGI 文件:

# +++++++++++ DJANGO +++++++++++
# To use your own Django app use code like this:
import os
import sys

# assuming your Django settings file is at '/home/myusername/mysite/mysite/settings.py'

path = '/home/HumBen/AMC_Inventory/venv/src/src/settings.py'

if path not in sys.path:
    sys.path.insert(0, path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'src.settings'

## Uncomment the lines below depending on your Django version
###### then, for Django >=1.5:
from django.core.wsgi import get_wsgi_application
stockmgmt = get_wsgi_application()
###### or, for older Django <=1.4
#import django.core.handlers.wsgi
#application = django.core.handlers.wsgi.WSGIHandler()

Server error:服务器错误:

2021-10-27 22:59:31,228: Error running WSGI application
2021-10-27 22:59:31,233: ModuleNotFoundError: No module named 'src'
2021-10-27 22:59:31,233:   File "/var/www/humben_pythonanywhere_com_wsgi.py", line 16, in <module>
2021-10-27 22:59:31,233:     application = get_wsgi_application()
2021-10-27 22:59:31,233: 
2021-10-27 22:59:31,233:   File "/home/HumBen/AMC_Inventory/venv/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2021-10-27 22:59:31,233:     django.setup(set_prefix=False)
2021-10-27 22:59:31,233: 
2021-10-27 22:59:31,233:   File "/home/HumBen/AMC_Inventory/venv/lib/python3.9/site-packages/django/__init__.py", line 19, in setup
2021-10-27 22:59:31,234:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2021-10-27 22:59:31,234: 
2021-10-27 22:59:31,234:   File "/home/HumBen/AMC_Inventory/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
2021-10-27 22:59:31,234:     self._setup(name)
2021-10-27 22:59:31,234: 
2021-10-27 22:59:31,234:   File "/home/HumBen/AMC_Inventory/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
2021-10-27 22:59:31,235:     self._wrapped = Settings(settings_module)
2021-10-27 22:59:31,235: 
2021-10-27 22:59:31,235:   File "/home/HumBen/AMC_Inventory/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
2021-10-27 22:59:31,235:     mod = importlib.import_module(self.SETTINGS_MODULE)
2021-10-27 22:59:31,235: ***************************************************

Thank you all in advance, blessings to all!先谢谢大家了,祝福大家!

Assuming that manage.py is in /home/HumBen/AMC_Inventory/venv/src , you should add this path to PYTHONPATH (here: via sys.path.insert call).假设manage.py/home/HumBen/AMC_Inventory/venv/src ,您应该将此路径添加到PYTHONPATH (此处:通过sys.path.insert调用)。 Then, assuming that settings.py is in /home/HumBen/AMC_Inventory/venv/src/src your current DJANOG_SETTINGS_MODULE config should work.然后,假设settings.py/home/HumBen/AMC_Inventory/venv/src/src您当前的DJANOG_SETTINGS_MODULE配置应该可以工作。 You need to change stockmgmt to application , as well.您还需要将stockmgmt更改为application Also -- remember to edit the wsgi file that is linked to in your Web page on PythonAnywhere and reload the web app.另外 -- 请记住在 PythonAnywhere 上编辑链接到您的网页中的 wsgi 文件并重新加载 Web 应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Pythonanywhere 中运行 WSGI 应用程序时出错 - Error running WSGI application in Pythonanywhere 运行WSGI应用程序Pythonanywhere Wagtail应用程序时出错 - Error running WSGI application Pythonanywhere Wagtail application 运行 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 在 Apache 中将脚本作为 wsgi 运行时未找到模块错误 - Module not found error when running script as wsgi within Apache 尝试使用 PythonAnyWhere 部署 Web Flask 应用程序时出现 WSGI 错误 - WSGI Error when Trying to Deploy Web Flask App with PythonAnyWhere 运行 WSGI 应用程序时出错 - client_secrets.json - Error Running WSGI application - client_secrets.json 运行WSGI应用程序时出错,ModuleNotFoundError:没有名为“ mysite”的模块 - Error running WSGI application , ModuleNotFoundError: No module named 'mysite' PythonAnywhere ImportError:没有名为wsgi的模块 - PythonAnywhere ImportError: No module named wsgi 在 pythonanywhere 设置 wsgi.py - Setup wsgi.py at pythonanywhere
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM