-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
64 lines (57 loc) · 1.67 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Output, Input
from apps import page1, page2, page3, page4
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP], suppress_callback_exceptions=True)
app.title = "Inequality in Latin America"
server = app.server
nav = dbc.NavbarSimple(
children=[
dbc.DropdownMenu(
children=[
dbc.DropdownMenuItem("By country", header=True),
dbc.DropdownMenuItem("General Info", href="/by-country"),
dbc.DropdownMenuItem("By Gender", href="/by-country-gender"),
dbc.DropdownMenuItem("By Area", href="/by-country-area"),
dbc.DropdownMenuItem("Back", href="/"),
],
nav=True,
in_navbar=True,
label="By country",
)
],
brand="Visualizing Inequality in Latin America",
brand_href="/",
color="dark",
dark=True
)
app.layout = html.Div(
[
dcc.Location(id='url', refresh=False),
html.Div(
[
html.Div(nav)
]
),
html.Div(id='page-content')
]
, id='doc')
@app.callback(
Output('page-content', 'children'),
[
Input('url', 'pathname')
]
)
def display_page(pathanme):
if pathanme == '/':
return page1.layout
if pathanme == '/by-country':
return page2.layout
elif pathanme == '/by-country-gender':
return page3.layout
elif pathanme == '/by-country-area':
return page4.layout
if __name__ == "__main__":
app.run_server(debug=True)