Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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)$
- HELLO_WORLD = """<html>
- <head>
- <title>Python Anywhere hosted web application</title>
- </head>
- <body>
- <h1>Hello, World!</h1>
- <p>
- This is the default welcome page for a
- <a href="https://www.pythonanywhere.com/">PythonAnywhere</a>
- hosted web application.
- </p>
- <p>
- Find out more about how to configure your own web application
- by visiting the <a href="https://www.pythonanywhere.com/web_app_setup/">web app setup</a> page
- </p>
- </body>
- </html>"""
- 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()
- 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 <module>
- 2018-07-18 12:19:25,789: application = get_wsgi_application()
Add Comment
Please, Sign In to add comment