Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
132 views
in Technique[技术] by (71.8m points)

python - How to generate multiple Dash App (and URLs) programmatically?

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:

  1. I'd like to avoid having to create 50 different dash apps (it doesn't look really practical neither scalable)
  2. 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:

  1. Dash doesn't allow to set a default base URL for the app (at least as far as I could tell)
  2. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...