PythonAnywhere WSGI错误

PythonAnywhere WSGI错误

问题描述:

尽管在过去的几周里我尽了最大的努力,但在尝试建立django框架时,我一直坚持在pythonanywhere上部署WSGI文件.这里有类似的主题,但我的案例没有一个可以采用.

in spite of my best efforts in the past weeks I've been stuck at deploying the WSGI file on Pythonanywhere while trying to set up a django framework. There are similar topics on here, but none were adoptable to my case.

我正在关注本教程,并收到以下错误消息:>

I'm following this tutorial and I get the following error message:

2017-03-04 22:28:05,284 :Error running WSGI application
2017-03-04 22:28:05,285 :ImportError: No module named 'mysite'
2017-03-04 22:28:05,285 :  File "/var/www/iamcsongor_pythonanywhere_com_wsgi.py", line 11, in <module>
2017-03-04 22:28:05,285 :    application = get_wsgi_application()
2017-03-04 22:28:05,285 :
2017-03-04 22:28:05,285 :  File "/home/iamcsongor/my-first-blog/myvenv/lib/python3.5/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
2017-03-04 22:28:05,285 :    django.setup(set_prefix=False)
2017-03-04 22:28:05,285 :
2017-03-04 22:28:05,285 :  File "/home/iamcsongor/my-first-blog/myvenv/lib/python3.5/site-packages/django/__init__.py", line 22, in setup
2017-03-04 22:28:05,286 :    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2017-03-04 22:28:05,286 :
2017-03-04 22:28:05,286 :  File "/home/iamcsongor/my-first-blog/myvenv/lib/python3.5/site-packages/django/conf/__init__.py", line 53, in __getattr__
2017-03-04 22:28:05,286 :    self._setup(name)
2017-03-04 22:28:05,286 :
2017-03-04 22:28:05,286 :  File "/home/iamcsongor/my-first-blog/myvenv/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
2017-03-04 22:28:05,287 :    self._wrapped = Settings(settings_module)
2017-03-04 22:28:05,287 :
2017-03-04 22:28:05,287 :  File "/home/iamcsongor/my-first-blog/myvenv/lib/python3.5/site-packages/django/conf/__init__.py", line 97, in __init__
2017-03-04 22:28:05,287 :    mod = importlib.import_module(self.SETTINGS_MODULE)

这是我的WSGI文件:

Here's my WSGI file:

import os

import sys

path = '/home/iamcsongor/my-first-blog/firstweb'  # use your own PythonAnywhere username here
if path not in sys.path:
    sys.path.append(path)

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

from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())

我已经拍摄了一些屏幕截图

I've taken a few screenshots of the code and Git Repo, if you could help, I'd be grateful. Thanks

如错误所示,您的DJANGO_SETTINGS_MODULE环境变量设置为"mysite",但该目录不存在.您的设置文件实际上似乎在"firstweb"中.

As the error says, your DJANGO_SETTINGS_MODULE environment variable is set to "mysite", but that directory does not exist. Your settings file actually appears to be in "firstweb".