-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.py
More file actions
39 lines (33 loc) · 1.03 KB
/
Copy pathindex.py
File metadata and controls
39 lines (33 loc) · 1.03 KB
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
import dash
from dash import html, dcc
from dash import callback_context
from dash.dependencies import Input, Output, State
from main import app
from Pages import admin, analytics, home, search
url_content_layout = html.Div(children=[
dcc.Location(id="url", refresh=False),
html.Div(id="output-div")
]
)
app.layout = url_content_layout
app.validation_layout = html.Div([
url_content_layout,
home.home_layout,
search.search_layout,
admin.admin_layout,
analytics.analytics_layout
]
)
@app.callback(Output(component_id="output-div", component_property="children"), Input(component_id="url", component_property="pathname"))
def update_output_div(pathname):
print(pathname)
if pathname == "/search":
return search.search_layout
elif pathname == "/admin":
return admin.admin_layout
elif pathname == "/analytics":
return analytics.analytics_layout
else:
return home.home_layout
if __name__ == '__main__':
app.run_server(debug=True)