Multiple Dashboards

I followed the example by creating the following structure, to create multiple dashboards each one implemented within app.* but it does not seem to show the graphs (the links do work and the layout seems to be right) however the @app.callback do not seem to be executed to refresh graphs based on the input in from - to date control (using my-date-picker-range component).

index.py

from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import dash

from app import app
from apps.KPI import app as app1
from apps.KPI_REPORTING import app as app2
from apps.KPI_STATS import app as app3

app = dash.Dash()

app.layout = html.Div([
dcc.Location(id=‘url’, refresh = False),
html.Div(id = ‘page-content’)
])

@app.callback(dash.dependencies.Output(‘page-content’, ‘children’),
[dash.dependencies.Input(‘url’, ‘pathname’)])
def display_page(pathname):
if pathname == ‘/apps/KPI’:
return app1.layout
elif pathname == ‘/apps/KPI_REPORTING’:
return app2.layout
elif pathname == ‘/apps/KPI_STATS’:
return app3.layout
else:
return ‘404’

app.css.append_css({
‘external_url’: ‘https://codepen.io/chriddyp/pen/bWLwgP.css’
})

if name == ‘main’:
print(‘running app …’)
app.run_server(
debug=True,
host=‘0.0.0.0’,
port=8050)

Hey there, welcome to the Dash community :slight_smile: Would you be able to post a minimal example of code that has the problem?

Hey! I am actually struggling with the same issue. Do you have multiple callbacks per app? Currently working on a team where there are several people making visualizations and the one causing the issue has more 3+ callbacks. If there’s a similarity there, we might’ve narrowed down part of the problem…

Could you simplify your example and share the code? i.e. can you create an example that minimally displays the issue?

Hi, @chriddyp! Thanks so much for looking into this. It was funny, because as I was typing this response to you, I was able to figure it out. :smiley_cat:

Here was the issue: Since I was taking dashboards from my coworkers, I was incorporating them as is into the server I made to handle multiple dashboards (using the great example you gave here, actually).

Except—and I’m “facepalming” now—of course each of those individual dashboards were set up to run independently with their own servers before being sent to me. I needed to incorporate them into the app.py file from that multiple dashboards example, and eliminate the oldapp references in the individual dashboard files. Doh!

I hope this rather silly revelation makes sense. :laughing:

1 Like