Hi. We’re working on a generic solution for Dash apps that run relatively long processes (30s to 2 mins) that can be deployed on Heroku without tripping up on server & browser timeouts and still provide a reasonable-ish user experience. To make a new app we just copy-paste the boilerplate, drop in whatever processes and visualizations are needed and deploy.
- Loading spinner
- Retrieve css from static files
- “Please wait” message
- Frequent refreshing to prevent browser timeout while process is running
- Long processes are run by a background worker via Redis to prevent server timeout
It pulls in a number of different solutions we found here and elsewhere so perhaps it’s useful to share as an all-in-one for anyone else to adapt and use.
Disclaimer: We’re new to Dash so if anyone spots something to improve on let us know!
Very nice! There have been several questions on the forum about how to deal with “long running processes”, so this is a really great contribution to the community. Thanks for sharing!
You’re very welcome! We’ll be refining this over time and pushing updates as we improve
Thank you so much for putting this together!
I was a bit in over my head when I was going to deploy my first dash app - and then I start getting timeout errors and find I need to use worker processes! which needless to say I knew nothing about…
Having your code as a template for the worker/request/callback structure was super helpful. Thank you thank you!
For other newbies:
In addition to the Wiley template, I referred to:
https://dash.plot.ly/deployment for deploying to Heroku. (be sure to expose the server variable! wasn’t obvious to me that that was important)
https://conda.io/docs/user-guide/tasks/manage-environments.html for managing environments (I’m on Windows, and using conda instead of pipenv)
Hi… is this boilerplate code still available? The specified git link doesn’t appear valid any longer.
Thank you very much for sharing. This is really helpful!!!