-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.py
47 lines (34 loc) · 1.13 KB
/
run.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
import logging
from app import app
from flask import redirect, url_for
import os
from sqlalchemy.dialects import registry
registry.register('postgresql.redshift', 'redshift' '', 'PGDialect_RedShift')
@app.before_request
def before_request():
logging.getLogger().setLevel(logging.INFO)
from views import query
from views import transformer
from views import user
from views import connection_string
from views import oauth2
from views import oauthclient
from views import homepage
app.register_blueprint(query.mod)
app.register_blueprint(transformer.mod)
app.register_blueprint(user.mod)
app.register_blueprint(connection_string.mod)
app.register_blueprint(oauth2.mod)
app.register_blueprint(oauthclient.mod)
app.register_blueprint(homepage.mod)
@app.context_processor
def inject_meta():
d = dict(favico=os.environ.get('favico'), logo=os.environ.get('logo'))
for key, val in os.environ.iteritems():
key = "env_" + key
d[key] = val
return d
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)