Deploying Streamlit on heroku

Hi I’m Trying to deploy my streamlit app on Heroku and I’m facing errors , However my app is running fine on my local machine . can someone help me with it ?

Hey @Amanweb200

Can you post what error is it showing?
You can check the application logs by following these steps -

  • Open the Heroku website
  • Click on your app name
  • Click on More (top right corner)
  • View Logs

Additionally, can you also post your repo link?

Best,
Kanak

1 Like

Hi kanak Thank you for reply , here is the link of my repo

Hey @Amanweb200

You need to make changes to your setup.sh and Procfile

In the setup.sh file you are dynamically trying to make changes to the configurations file inside the .streamlit folder when the folder does not exist at all. Here are the changes that you need to make -

mkdir -p ~/.streamlit/
echo "\
[server]\n\
headless = true\n\
port = $PORT\n\
enableCORS = false\n\
\n\
" > ~/.streamlit/config.toml

Now, in the Procfile, you are asking Heroku to load app.py file when it boots which exists in the root folder but you are setting its path inside the .streamlit folder. Here are the required changes -

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

It is working well after making these changes.

Best,
Kanak