-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
49 lines (34 loc) · 1.12 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
from dash import Dash, dcc, html, Input, Output, callback
import dash_bootstrap_components as dbc
import webbrowser
from threading import Timer
from appPages import simpleApp, multiApp
# external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
# app = Dash(__name__, suppress_callback_exceptions=True)
# MATERIA
# LUMEN
# SANDSTONE
app = Dash(__name__, suppress_callback_exceptions=True,
external_stylesheets=[dbc.themes.MATERIA]
)
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content')
])
# Update the index
@ callback(Output('page-content', 'children'),
[Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/multiApp':
return multiApp.layout
elif pathname == '/simpleApp':
return simpleApp.layout
else:
return multiApp.layout
# You could also return a 404 "URL not found" page here
# port = 8050
def open_browser():
webbrowser.open_new("localhost:8050")
if __name__ == "__main__":
Timer(1, open_browser).start()
app.run_server(debug=True, port=8050, use_reloader=False)