Forums

how to start script

Hi,

I have a directory structure like this :

    \app
           \__init__.py
            \views.py
    \tmp
    \app\static
    \app\templates
    run.py

__init__.py has

from flask import Flask

app = Flask(__name__)
from app import views

run.py has :

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

so that I can say python run.py ro start the server.

I am a bit confused on how to get this on pythonanywhere...?

as there's a pythonanywhere_com_wsgi.py which has :

# This file contains the WSGI configuration required to serve up your
# web application at http://<your-username>.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# The below has been auto-generated for your Flask project

import sys

# add your project directory to the sys.path
project_home = u'/home/susarla/mysite/microblog'
if project_home not in sys.path:
    sys.path = [project_home] + sys.path

# import flask app but need to call it "application" for WSGI to work
from run import app as application

for some reason I cannot get the app to run in this directory structure mode. Can anyone please tell me what I am missing?

Here is the documentation on how to setup a Flask app on PythonAnywhere. In particular, pay attention to the section titled "Do not use app.run()", but the rest should give you an idea of what you need to do.