-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
40 lines (31 loc) · 971 Bytes
/
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
import dash
import flask
from flask_caching import Cache
import dash_auth
from environment import settings
from layout import generate_layout
from routes import setup_routing
from storage import container as storage_container
flask_server = flask.Flask(__name__)
VALID_USERNAME_PASSWORD_PAIRS = [(f'{settings.LOGIN_USERNAME}', f'{settings.LOGIN_PASSWORD}')]
app = dash.Dash(
__name__,
server=flask_server,
suppress_callback_exceptions=True,
external_stylesheets=settings.EXTERNAL_STYLESHEETS,
external_scripts=settings.EXTERNAL_SCRIPTS,
meta_tags=[
{"name": "viewport", "content": "width=device-width, initial-scale=1"}
]
)
auth = dash_auth.BasicAuth(
app,
VALID_USERNAME_PASSWORD_PAIRS
)
cache = Cache(app.server, config={
'CACHE_TYPE': settings.CACHE_TYPE,
'CACHE_DIR': settings.CACHE_LOCATION
})
routes = setup_routing(app)
app.layout = generate_layout(routes, storage_container.stores)
server = app.server