-
Notifications
You must be signed in to change notification settings - Fork 0
/
wareporting.py
42 lines (35 loc) · 1.59 KB
/
wareporting.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
from dotenv import load_dotenv
# If a .env file is found it will override the environment!
# Should be used only for development, and not added to git
# (there is a .gitignore directive already)
load_dotenv()
from flask import Flask
from flask_executor import Executor
from reports import reports_blueprint
from auth import auth_blueprint
import logging
import os
logger = logging.getLogger(__name__)
# This code sets up the flask application and registers the auth and reports
# blueprints. It also sets a secret key which is used to sign session cookies
# and other things. The secret key is stored in the environment variable
# WA_REPORTING_FLASK_SECRET_KEY
app = Flask(__name__)
app.register_blueprint(auth_blueprint)
app.register_blueprint(reports_blueprint, url_prefix='/reports')
app.secret_key = os.environ['WA_REPORTING_FLASK_SECRET_KEY']
# flask_executor plugin configuration
app.config['EXECUTOR_TYPE'] = 'thread'
app.config['ALLOW_LOCALHOST'] = False
app.config['MAX_CONTENT_LENGTH'] = 16 * 1000 * 1000 # 16 MB max file upload size
if __name__ == "__main__":
# This code will only run if you run this file directly. It will not run
# for production servers. It sets up useful logging.
app.debug = True
app.config['ALLOW_LOCALHOST'] = True
logging.basicConfig(level=logging.WARNING)
logging.getLogger('reports').setLevel(logging.DEBUG)
logging.getLogger('wareporting').setLevel(logging.DEBUG)
#logging.getLogger('wadata').setLevel(logging.DEBUG)
logger.warning("Running in dev mode. This should not be used for production.")
app.run(port = os.environ.get("PORT", 5000))