Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# +++++++++++ FLASK +++++++++++ 

2# Flask works like any other WSGI-compatible framework, we just need 

3# to import the application. Often Flask apps are called "app" so we 

4# may need to rename it during the import: 

5# 

6# 

7import sys 

8 

9sys.path.append(os.getcwd()) 

10from app import create_app 

11 

12# 

13# The "/home/appinv" below specifies your home 

14# directory -- the rest should be the directory you uploaded your Flask 

15# code to underneath the home directory. So if you just ran 

16# "git clone git@github.com/myusername/myproject.git" 

17# ...or uploaded files to the directory "myproject", then you should 

18# specify "/home/appinv/myproject" 

19# on shell do pwd to get a path like this:'/home2/folder/shopyo/shopyo' set path to this 

20path = "" 

21if path not in sys.path: 

22 sys.path.insert(0, path) 

23# 

24 

25 

26application = create_app("production") 

27 

28# 

29# NB -- many Flask guides suggest you use a file called run.py; that's 

30# not necessary on PythonAnywhere. And you should make sure your code 

31# does *not* invoke the flask development server with app.run(), as it 

32# will prevent your wsgi file from working. 

33# whatever app you specify, modify that