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 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 -f


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


python makemigrations
python migrate


heroku run python makemigrations
heroku run python migrate 

Reset your sequence

If you copy data from local to remote, your sequences will get messed up. Here’s help on resolving.

select max(id) from "whiskeydiary_whiskey";
select nextval('"whiskeydiary_whiskey_id_seq"');
select setval(pg_get_serial_sequence('"whiskeydiary_whiskey"', 'id'), max(id)) from "whiskeydiary_whiskey";
select max(id) from "whiskeydiary_distillery";
select nextval('"whiskeydiary_distillery_id_seq"');
select setval(pg_get_serial_sequence('"whiskeydiary_distillery"', 'id'), max(id)) from "whiskeydiary_distillery";
select max(id) from "whiskeydiary_whiskeyinstance";
select nextval('"whiskeydiary_whiskeyinstance_id_seq"');
select setval(pg_get_serial_sequence('"whiskeydiary_whiskeyinstance"', 'id'), max(id)) from "whiskeydiary_whiskeyinstance";

Getting a 404 in Vagrant?

Are you continually getting a 404 warning after vagrant up?

The following line in your vagrantfile should do the trick:


Thanks to  Val on github for the tip.

Under new management

For the last five years has been hosted by A Small Orange. I was happy enough with their service but wanted something more customizable. So I stood up a Linux box on Linode and exported most of my old content to the new site. (I forgot to back up my blog before I changed the nameserver entries, but that’s a story for another day.)

My plan for the next five years is to move my family history data to MongoDB (So long, primary keys!) And implement a PHP framework.