-
Notifications
You must be signed in to change notification settings - Fork 0
/
playground.py
54 lines (27 loc) · 1017 Bytes
/
playground.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
from flask import Flask, session
from flask_script import Manager, Shell
# Configure base directory of app
basedir = os.path.abspath(os.path.dirname(__file__))
# App setup code
app = Flask(__name__)
app.debug = True
# All app.config values
app.static_folder = 'static'
app.config['SECRET_KEY'] = 'hardtoguessstringfromsi364'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql://localhost/midterm_playground"
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
# Setting up the VIEWS (forms and templates)
from view import *
# Setting up the CONTROLLER
# Set up Flask debug stuff
manager = Manager(app)
# Manager setup
def make_shell_context():
return dict(app=app, db=db, User=User, Food = Food)
manager.add_command("shell", Shell(make_context=make_shell_context))
if __name__ == '__main__':
db.create_all()
manager.run() # NEW: run with this: python main_app.py runserver
# Also provides more tools for debugging