3

I now I can integrate Python Dash with Flask, but is it possible to have more than one dashboards within single Flask application? The reason is that I want to have different dashboards for different User Groups, and I want each dashboard to scale independently from the other.

1 Answer 1

6

You can just create multiple dash instances. I'm not exactly sure what you mean with scale independently?

Example

Below is a minimal example of creating 2 dash instances. You can just add your figures and callbacks as you're used to.

import dash
import dash_html_components as html
from flask import Flask

server = Flask(__name__)

# Set-up endpoint 1
app_1 = dash.Dash(__name__, server=server, url_base_pathname='/app1/')
app_1.layout = html.H1('App 1')

# Set-up endpoint 2
app_2 = dash.Dash(__name__, server=server, url_base_pathname='/app2/')
app_2.layout = html.H1('App 2')

# Run server
server.run()
Sign up to request clarification or add additional context in comments.

3 Comments

I can't get this to work with a recent version of Dash: I'm just getting 404 errors for all urls.
Yes - but I've realised the problem is in my web-config - how the web server is configured. It wasn't running wfastcgi for /app1/. Obvious really - sorry.
Since Dash 2.0 this pattern is not longer supported. Each Dash instance now sets up global state in the dash module, so only one Dash instance should be run in a process at time, otherwise you'll find things breaking in weird and surprising ways.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.