I have a simple Dash app with a choropleth map along with a simple dropdown. The data is sourced from a pandas dataframe and contains a few different metrics for each US state.
I'd like to reproduce this standard layout for each of the US state but here's the problem:
- I'd like to avoid having to create 50 different dash apps (it
doesn't look really practical neither scalable)
- I don't want to have a dropdown for users to select the state: the goal is to have multiple URLs, one for each state (mostly for search engine purposes).
I was thinking of passing the US state as a URL parameter: I'd use this variable to filter the dataframe (limiting the dataframe scope will automatically make the choropleth zoom to the relevant state). However this is problematic since:
- Dash doesn't allow to set a default base URL for the app (at least as far as I could tell)
- The df cleaning/filtering happens before I can call the flask instance in Dash (this would be easily solvable though) as well as the app URL.
I wanted to do this all within Dash for practicality but I guess I'd need to rely on Flask/Django for the actual scaffolding and pull in Dash content from there?
question from:
https://stackoverflow.com/questions/65894970/how-to-generate-multiple-dash-app-and-urls-programmatically 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…