Black Lives Matter. Please consider donating to Black Girls Code today.

Embed Dash inside Flask

As I begin to move from using Dash as a personal side-project to using it for full-fledged client-facing web applications, I’m questioning how best to fit it into the big picture. Big thanks to @TheToddfather for sharing this informative (and funny!) blog post about flipping the tables on Flask and Dash.

“we cannot start our app as an instance of Dash and attempt to work around it. Instead, we must create a Flask app, and put Dash in its place as an app embedded in our app. This gives us full control over when users can enter the Dash interface, and even within that interface, we can still manage database connections or user sessions as we see fit.”

Read more: https://hackersandslackers.com/gaining-full-control-over-plotly-dash/#ixzz5doOev0XM

1 Like

Others have raised this same question, and @chriddyp has provided some guidance about embedding Dash as an iframe.

I’m working on a PR for this here: https://github.com/plotly/dash-docs/pull/357

Two other strategies for integration with existing web apps aside from iframes are outlined in this issue: https://github.com/plotly/dash-docs/issues/246

1 Like

I’ve been looking for a way to embed a Dash app inside a bigger project (with a login system, or a subscription based app for example) for a while, nice to see other people working on this same problem!

1 Like

The link is broken - Here is an alternative:

I followed this repo here: https://github.com/okomarov/dash_on_flask

Together with a multipage approach using dash bootstrap components.

I wrote about early mistakes here: Embed multipage Dash app in existing Flask app with dash-bootstrap-components