How to Deploy your Streamlit app using Heroku

Rahul Banerjee
ILLUMINATION
Published in
3 min readOct 2, 2020

--

What’s the point of building a fancy web app if you can’t show off your dashboard/model to the world? 🌎 In this tutorial, we will deploy a Streamlit app using Heroku

Photo by Joshua Aragon on Unsplash

Things you will need

  • Heroku Account
  • Github Account
  • A Streamlit app you want to deploy, I will be deploying this app. If you are want to learn how to build a streamlit app to scrape Github, check out my previous article

Files needed

Requirements.txt

pip freeze > requirements.txt

The above command lists down all the libraries your app uses in a text file. Make sure your virtual environment is activated before you type the above command.

Procfile

web: sh setup.sh && streamlit run app.py

Create a file and name it ‘Procfile’. Make sure it has no extension and its name is set to ‘Procfile’. Inside the file, paste the above content. If your app.py is inside a folder app, it should be ‘ streamlit run app/app.py’

setup.sh

mkdir -p ~/.streamlit/ echo "\
[general]\n\
email = \"{your_email_id}\"\n\
" > ~/.streamlit/credentials.toml

--

--