Setting up Django 1.8 with PostgreSQL to run on Heroku - that’s straightforward. Just follow the official Heroku documentation Getting Started with Django on Heroku. But what if you want or need to do development locally on Windows? Then this is the guide for you.
This guide will show you how to setup the following stack:
- Python 3.4.3
- Django 1.8
- PostgreSQL 9.3.4
and how you can develop on Windows and deploy to Heroku Linux.
For this guide, I’ll assume you are starting from scratch - as in you just installed a new copy of Windows. I’ll also try to explain some of the why so when this guide becomes out of date, you can hopefully figure out how to handle new version numbers.
If you just want to final code, grab it from Bitbucket.
Why Develop on Windows
Before we get into the details, I want to first talk about why.
Getting Django to run on Windows is harder than on Linux. You often have to find reliable pre-compiled packages. Your development environment will not exactly match your production environment so you may run into issues that are unique to one environment or the other. Remember that even if you boot to Windows, you can still installl Linux in a virtual machine, such as VirtualBox, and develop on Linux.
Then why am I explaining how to setup a Windows environment? I sometimes spend long periods of time disconnected from power and running in a virtual machine drains the battery faster. I still maintain a Linux virtual machine for primary development - the Windows environment is secondary.
Think twice before going down the path of Windows as your primary development environment. But if you still want to, I’ll tell you how.
There are quite a few steps to get things running, so I’ve split this guide into several parts.
- Introduction (this page)
- Setup and Run Django+Heroku Locally on Windows
- Change from SQLite to PostgreSQL
- Split Windows and Linux Configurations