Description
Before Dash 2.0, it was possible to attach multiple dash.Dash
app instances to a single flask.Flask
server instance by passing the same Flask server in to each Dash app using the server
param. This pattern was for a time documented in the Dash docs. Since then, a number of Dash features have been introduced which involve dash.Dash
instances setting global state associated with the app in the dash
module. This means that it is not longer safe to run multiple Dash instances within the same process (and hence has been removed from the docs).
Since the docs briefly officially supported this pattern, and there are a numerous places online of people sharing solutions of how to attach multiple Dash instances to a Flask server, it would be good for the Dash docs to explicitly call out that spinning up more than one Dash instance in a process is not supported, and is likely to break things in fun and unexpected behaviour.
Links with now unsupported multi Dash-app solutions
- Dash App with Multiple Flask Routes #70
- https://towardsdatascience.com/embed-multiple-dash-apps-in-flask-with-microsoft-authenticatio-44b734f74532
- https://stackoverflow.com/a/59628371/77533
- https://stackoverflow.com/a/51855852/77533
- https://stackoverflow.com/a/51255720/77533
- https://community.plotly.com/t/how-to-add-your-dash-app-to-flask/51870
- https://community.plotly.com/t/embedding-more-than-one-multi-page-dash-apps-in-a-flask-app/70945
Dash features relying on global state
- The
dash.callback
decorator - Dash Pages
get_asset_url()