-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
55 lines (37 loc) · 1.11 KB
/
app.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
55
import flask
import logging
import pymysql.cursors
from api import register_apis
from util import DBConnectionManager
# from authentication_util import requires_auth
from flask import (Flask,
render_template,
request,
session)
app = Flask(__name__)
db_connection_manager = DBConnectionManager(app)
# Shhhh...
# app.secret_key = b"ECWX19omH08U8E3e"
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
@app.route("/")
# @requires_auth
def home():
return render_template("home.html")
def main():
logger.info("Loading app with Flask version {}".format(flask.__version__))
register_apis(app, db_connection_manager.db)
app.logger.handlers = logger.handlers
app.logger.setLevel(logging.DEBUG)
app.run(host="0.0.0.0",
port=9000,
use_reloader=True,
debug=True
)
if __name__ == "__main__":
main()
else:
gunicorn_logger = logging.getLogger("gunicorn.error")
app.logger.handlers = gunicorn_logger.handlers
app.logger.setLevel(gunicorn_logger.level)