How to Deploy your Dash App on Heroku
Step-by-step instructions to share your app with the world
You just spent weeks developing your Dash app. It now looks great and you want the world to see it? This tutorial will show you how to do just that using Heroku.
Heroku is a cloud application platform that allows you to run your apps, completely free of charge.
What you will need
For this tutorial, you will need to install a few things:
- Heroku account: https://id.heroku.com/login
- Git Bash: https://git-scm.com/download/win
- Virtualenv, which can be installed with pip:
pip install virtualenv
.
You should also download 4 files, all available right here: https://github.com/francoisstamant/dash_heroku_deployment.
App.py
is the file that contains your Dash appplication. That’s the file that you should be changing if you want to update/improve the app.
requirements.txt
contains the Python dependencies needed to run the app itself.
Step by step tutorial
Alright, now that you got everything needed, here is the step-by-step tutorial that will get you to deploy your Dash app for everyone else to see!
- Open Git. From there, type the following code to create a folder for the project and make that folder the current directory.
$mkdir dash_app_deployment
$cd dash_app_deployment
2. Initialize the folder with an empty Git repository with $ git init
.
3. Create a virtual environment called venv with $ virtualenv venv
.
4. If you are using Git Bash In order to activate the environment, you need to make the Scripts folder the current directory first. Then, you can activate the environment. Here are the commands:
5. Then, install Dash and Gunicorn in the virtual environment:
$ pip install dash
$ pip install gunicorn
Just a heads up, it can take a while to install dash (took about 4 minutes for me).