-
Notifications
You must be signed in to change notification settings - Fork 1
/
runp.py
49 lines (38 loc) · 1.49 KB
/
runp.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
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
import plotly.graph_objs as go
import pandas as pd
import json
from flask import session
from app import app
from dash_app import app_main, chksubtime
print(dcc.__version__) # 0.6.0 or above is required
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content'),
html.Div(id='inst_opeid', style={'display': 'none'}),
html.Div(dt.DataTable(rows=[{}]), style={'display': 'none'}),
html.Div(dcc.Graph(id='dummy_g1'), style={'display': 'none'}),
html.Div(dcc.RadioItems(), style={'display': 'none'}),
html.Div(dcc.Dropdown(), style={'display': 'none'}),
html.Div(dcc.Tabs(tabs=[{}]), style={'display': 'none'}),
html.Div(id='dummy_div1', style={'display': 'none'})
#The 5 lines above are super important to initiate the dcc or dt components so they
#can be displayed when called. Otherwise it'll show no error and just a white page
])
# Update the index
@app.callback(dash.dependencies.Output('page-content', 'children'),
[dash.dependencies.Input('url','pathname')])
def display_page(pathname):
pathname = str(pathname)
if pathname == '/demo':
return app_main.layout
elif pathname == '/chksubtime':
return chksubtime.layout
else:
return '404'
if __name__ == '__main__':
app.run_server(debug=False,host='0.0.0.0')