Tips for developing Python apps for Heroku on Windows

This tutorial assumes you have a Heroku account, aren’t super-familiar with Django, and are working on Windows 10.

Start with this tutorial.

You’ll also want to follow these instructions.

I also recommend installing PGAdmin if you want a GUI interface to manage your database.

Key commands

You’ll want to create a separate .env file. I called mine .env.dev. Be sure to add that file to your .gitignore

To start your local instance with your customized .env file run this (make sure you cd into the folder where the app is located):

heroku local web -e .env.dev -f Procfile.windows

Commits

git add . && git commit -m "your message"
git push heroku main

Database changes

To keep your local database in sync with Heroku, you’ll need to run the same commands in each environment

Local

python manage.py makemigrations
python manage.py migrate

Remote

heroku run python manage.py makemigrations
heroku run python manage.py migrate