-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
30 lines (25 loc) · 885 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
from dash import Dash, dcc, html, Input, Output, callback
import dash_bootstrap_components as dbc
from pages import home, resources, contact, lisa
external_stylesheets = [dbc.themes.UNITED]
app = Dash(__name__, external_stylesheets=external_stylesheets, suppress_callback_exceptions=True)
server = app.server
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content')
])
@callback(Output('page-content', 'children'),
Input('url', 'pathname'))
def display_page(pathname):
if pathname == '/home':
return home.layout
elif pathname == '/resources':
return resources.layout
elif pathname == '/contact':
return contact.layout
elif pathname == '/lisa':
return lisa.layout
else:
return home.layout
if __name__ == '__main__':
app.run_server(host='127.0.0.1', debug=True)