-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
36 lines (30 loc) · 1020 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
31
32
33
34
35
36
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
import plotly
import dash
from server import app, server
from views import home, sidebar, debug
import sys
content = html.Div(id="page-content", className="content")
app.layout = html.Div(
[dcc.Location(id="url"), sidebar.layout, content]
)
@app.callback(
Output("page-content", "children"), Input("url", "pathname")
)
def render_page_content(pathname):
if pathname == "/":
return home.layout
elif pathname == "/demo":
return debug.layout
elif pathname == "/github":
return html.P("Redirecting to GitHub repository...")
# If the user tries to reach a different page, return a 404 message
return dbc.Jumbotron([
html.H1("404: Not found", className="text-danger"),
html.Hr(),
html.P(f"The pathname {pathname} was not recognised..."),
])
if __name__ == '__main__':
app.run_server(host='127.0.0.2', debug=True)