7

I have a working sample site with the file system as such (https://github.com/alvations/APE):

APE
    \app
        \templates
            base.html
            index.html
            instance.html
        __init__.py
        hamlet.py
    config.py
    run.py

I have created a flask project on https://www.pythonanywhere.com and the file system is as such:

/home/alvations/
    /Dropbox/
    /mysite/
        /templates
            base.html
            index.html
            instance.html
        flask_app.py
    /web2py/

enter image description here

Where do I place my run.py in my pythonanywhere project?

How do I use the same file structure as my the project in my Github on pythonanywhere?

1 Answer 1

8

PythonAnywhere dev here -- you don't need a run.py on PythonAnywhere. The code that normally goes in there is to run a local Flask server that can serve your app -- that's all handled for you by our system.

Instead, you need to change the WSGI file (linked from the "Web" tab) to import the appropriate application module. So, because the sample site you have on github does

from app import app
app.run(debug=True)

...on PythonAnywhere in the WSGI file you'll need to do this:

from app import app as application

One thing to be aware of -- if I'm understanding your file listings above correctly, you don't have all of the github app installed -- only the templates. You'll need __init__.py, hamlet.py, and config.py, and they'll need to be in the same directory structure as the original.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, changing the WSGI file and keeping the original directory structure worked!!! Kudos to pythonanywhere, it made web deployment much easier than it was !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.