(Image by author, inspired by Charlie the Unicorn and Gunicorn)

Hands-on Tutorials

Deploying your Dash App to Heroku — THE MAGICAL GUIDE

The way I think of the technology stack

The magical ingredients to add to your project

(Image from pixilart.com, Source: https://art.pixilart.com/6977a966cd0f6a7.png)
web: gunicorn app:server
app = dash.Dash(__name__)
server = app.server
python-3.7.8

It’s time for magic

(Image from pixilart.com, Source: https://art.pixilart.com/6977a966cd0f6a7.png)
git push heroku main
heroku logs --tail

Cheat Sheet: Useful commands from Heroku CLI

heroku apps
heroku psheroku ps -a <yourapp>
heroku ps:scale web=2:standard-1x
heroku run bash -a <yourapp>
heroku dyno:restart
heroku labs:enable log-runtime-metrics
heroku logs --tail

HEROKU TIP: Add runtime metrics to log

heroku logs --tail
heroku labs:enable log-runtime-metrics

HEROKU PITFALL: Serving static files does not work

from whitenoise import WhiteNoise
server = app.server
server.wsgi_app = WhiteNoise(server.wsgi_app, root=‘static/’)
app.wsgi_app = WhiteNoise(app.wsgi_app, root=‘static/’)

HEROKU PITFALL: Favicon may not work

/assets/favicon.ico
heroku run bash -a <yourappname>

HEROKU PITFALL: Web concurrency is important and can be configured

heroku config:set WEB_CONCURRENCY=3heroku config:set WEB_CONCURRENCY=3 -a <herokuappname>

HEROKU PITFALL: Hard limit 30 second request timeout

HEROKU PITFALL: Develop on the master/main branch of your GitHub repository

Useful Stuff

Animate-salamander-8duwlndghfqbtj0t90uep8bmu.herokudns.com 

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store