Heroku: Run a Python App Locally
Author: Jacek Trociński, Last Revision: 2021.03.11, Topic area: HerokuThe Heroku command-line makes it possible to run a Python app locally using Heroku Config Vars defined for your app.
Start by exporting your app's Config Vars to a .env
file and then edit the values in the
file to meet the needs of your local environment. On Windows use Git Bash to do this so that the file
has the right encoding.
$ heroku config -s -a <app_name> > .env
Remember to exclude the .env
file from you Git repository by placing it in a
.gitignore
file.
Lastly, make sure you have a Procfile defined so that you can run your app locally using the command:
$ heroku local
Alternatively, if you have a separate Proc file defined for Windows then use the command:
$ heroku local -f Procfile.windows