trotz meiner Bemühungen in den letzten WochenIch bin bei der Bereitstellung der WSGI-Datei auf Pythonanywhere stecken geblieben, während ich versuchte, ein Django-Framework zu erstellen. Es gibt ähnliche Themen hier, aber keine war zu meinem Fall adoptierbar.
Ich folge dieses Tutorial und ich bekomme folgende Fehlermeldung:
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)
Hier ist meine WSGI-Datei:
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())
Ich habe ein paar genommen Screenshots des Codes und Git RepoWenn du mir helfen könntest, wäre ich dankbar. Danke
Antworten:
4 für die Antwort № 1Wie der Fehler sagt, ist Ihre DJANGO_SETTINGS_MODULE-Umgebungsvariable auf "mysite" gesetzt, aber dieses Verzeichnis existiert nicht. Ihre Einstellungsdatei scheint tatsächlich in "firstweb" zu sein.