-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathroutes.py
30 lines (24 loc) · 907 Bytes
/
routes.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
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output
from app import app
from utils.constants import home_page_location, gdp_page_location, iris_page_location
from pages.home import home
from pages.gdp import gdp
from pages.iris import iris
@app.callback(Output("page-content", "children"), [Input("url", "pathname")])
def render_page_content(pathname):
if pathname == home_page_location:
return home.layout
elif pathname == gdp_page_location:
return gdp.layout
elif pathname == iris_page_location:
return iris.layout
# 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..."),
]
)