Boilerplate Heroku Dash App for Long Processes (show and tell)

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.

https://github.com/WileyIntelligentSolutions/wiley-boilerplate-dash-app

Main features:

  • 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!

14 Likes

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!

2 Likes

You’re very welcome! We’ll be refining this over time and pushing updates as we improve :slight_smile:

1 Like

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)

-AS

2 Likes

Hi… is this boilerplate code still available? The specified git link doesn’t appear valid any longer.

try this:https://github.com/WileyIntelligentSolutions/wiley-dash-boilerplate2

2 Likes

Thank you very much for sharing. This is really helpful!!!