|
1 | 1 | # import dash-core, dash-html, dash io, bootstrap
|
| 2 | +import os |
| 3 | + |
2 | 4 | import dash_core_components as dcc
|
3 | 5 | import dash_html_components as html
|
4 | 6 | from dash.dependencies import Input, Output
|
|
25 | 27 | from app import srv as server
|
26 | 28 |
|
27 | 29 |
|
| 30 | +app_name = os.getenv("DASH_APP_PATH", "/dash-baseball-statistics") |
| 31 | + |
28 | 32 | # Layout variables, navbar, header, content, and container
|
29 | 33 | nav = Navbar()
|
30 | 34 |
|
|
49 | 53 | # Declair function that connects other pages with content to container
|
50 | 54 | @app.callback(Output("page-content", "children"), [Input("url", "pathname")])
|
51 | 55 | def display_page(pathname):
|
52 |
| - if pathname == "/": |
| 56 | + if pathname == app_name: |
53 | 57 | return html.Div(
|
54 | 58 | [
|
55 | 59 | dcc.Markdown(
|
@@ -78,11 +82,11 @@ def display_page(pathname):
|
78 | 82 | ],
|
79 | 83 | className="home",
|
80 | 84 | )
|
81 |
| - elif pathname == "/team": |
| 85 | + elif pathname.endswith("/team"): |
82 | 86 | return appMenu, menuSlider, teamLayout
|
83 |
| - elif pathname == "/player": |
| 87 | + elif pathname.endswith("/player"): |
84 | 88 | return appMenu, menuSlider, playerMenu, battingLayout
|
85 |
| - elif pathname == "/field": |
| 89 | + elif pathname.endswith("/field"): |
86 | 90 | return appMenu, menuSlider, playerMenu, fieldingLayout
|
87 | 91 | else:
|
88 | 92 | return "ERROR 404: Page not found!"
|
|
0 commit comments