Почему не применяются изменения в _pythonanywhere_com_wsgi.py?
Следовал по этой инструкции.
(myenv) 13:17 ~/1website_v1 (master)$ pwd /home/Goganoid/1website_v1 (myenv) 13:17 ~/1website_v1 (master)$ ls README.md db.sqlite3 jinjalesson learntime manage.py media static tinymce webexample (myenv) 13:17 ~/1website_v1 (master)$
В learntime находится settings.
Так выглядит мой _pythonanywhere_com_wsgi.py:
HELLO_WORLD = """ Python Anywhere hosted web application Hello, World!
This is the default welcome page for a PythonAnywhere hosted web application.
Find out more about how to configure your own web application by visiting the web app setup page
""" def application(environ, start_response): if environ.get('PATH_INFO') == '/': status = '200 OK' content = HELLO_WORLD else: status = '404 NOT FOUND' content = 'Page not found.' response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))] start_response(status, response_headers) yield content.encode('utf8') # Below are templates for Django and Flask. You should update the file # appropriately for the web framework you're using, and then # click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site # live. # +++++++++++ VIRTUALENV +++++++++++ # If you want to use a virtualenv, set its path on the web app setup tab. # Then come back here and import your application object as per the # instructions below # +++++++++++ CUSTOM WSGI +++++++++++ # If you have a WSGI file that you want to serve using PythonAnywhere, perhaps # in your home directory under version control, then use something like this: # #import sys # #path = '/home/Goganoid/path/to/my/app #if path not in sys.path: # sys.path.append(path) # #from my_wsgi_file import application # noqa # +++++++++++ DJANGO +++++++++++ # To use your own django app use code like this: import os import sys # assuming your django settings file is at '/home/Goganoid/mysite/mysite/settings.py' # and your manage.py is is at '/home/Goganoid/mysite/manage.py' path = '/home/Goganoid/1website_v1' if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'learntime.settings' # then: from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
Сайт я перезапускал.
Но выдает ошибку somethin went wrong.
Вот ошибка из errorlog'а:
2018-07-18 12:19:25,781: Error running WSGI application 2018-07-18 12:19:25,789: ModuleNotFoundError: No module named '1website_v1.settings' 2018-07-18 12:19:25,789: File "/var/www/goganoid_pythonanywhere_com_wsgi.py", line 22, in 2018-07-18 12:19:25,789: application = get_wsgi_application()
Почему используется путь '1website_v1.settings', а не 'learntime.settings'?
Где я мог накосячить и как фиксится?
(myenv) 13:17 ~/1website_v1 (master)$ pwd /home/Goganoid/1website_v1 (myenv) 13:17 ~/1website_v1 (master)$ ls README.md db.sqlite3 jinjalesson learntime manage.py media static tinymce webexample (myenv) 13:17 ~/1website_v1 (master)$
В learntime находится settings.
Так выглядит мой _pythonanywhere_com_wsgi.py:
HELLO_WORLD = """ Python Anywhere hosted web application Hello, World!
This is the default welcome page for a PythonAnywhere hosted web application.
Find out more about how to configure your own web application by visiting the web app setup page
""" def application(environ, start_response): if environ.get('PATH_INFO') == '/': status = '200 OK' content = HELLO_WORLD else: status = '404 NOT FOUND' content = 'Page not found.' response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))] start_response(status, response_headers) yield content.encode('utf8') # Below are templates for Django and Flask. You should update the file # appropriately for the web framework you're using, and then # click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site # live. # +++++++++++ VIRTUALENV +++++++++++ # If you want to use a virtualenv, set its path on the web app setup tab. # Then come back here and import your application object as per the # instructions below # +++++++++++ CUSTOM WSGI +++++++++++ # If you have a WSGI file that you want to serve using PythonAnywhere, perhaps # in your home directory under version control, then use something like this: # #import sys # #path = '/home/Goganoid/path/to/my/app #if path not in sys.path: # sys.path.append(path) # #from my_wsgi_file import application # noqa # +++++++++++ DJANGO +++++++++++ # To use your own django app use code like this: import os import sys # assuming your django settings file is at '/home/Goganoid/mysite/mysite/settings.py' # and your manage.py is is at '/home/Goganoid/mysite/manage.py' path = '/home/Goganoid/1website_v1' if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'learntime.settings' # then: from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
Сайт я перезапускал.
Но выдает ошибку somethin went wrong.
Вот ошибка из errorlog'а:
2018-07-18 12:19:25,781: Error running WSGI application 2018-07-18 12:19:25,789: ModuleNotFoundError: No module named '1website_v1.settings' 2018-07-18 12:19:25,789: File "/var/www/goganoid_pythonanywhere_com_wsgi.py", line 22, in 2018-07-18 12:19:25,789: application = get_wsgi_application()
Почему используется путь '1website_v1.settings', а не 'learntime.settings'?
Где я мог накосячить и как фиксится?
Похожие публикации
Как с помощью sys_getloadavg построить примерный график нагрузки сервера?
программа как иерархия папок
[Решено] Как создать комбинированную ссылку на функцию?
Python3+uwsgi на Ubuntu 16.04. No module named 'encodings' — как узнать в чем дело?
Нет комментариев