I’m currently in the process of moving from Django 1.4 to 1.8 and Python 2.7 to 3.4. The main reason I’m writing this is so that someone else making the same changes doesn’t need to work too hard.
This is one of my gripes about the Django Foundation. They don’t consider that there will be a fair number of projects jumping from one long term support to another. Instead, they recommend going from 1.4 to 1.5 to 1.6 to 1.7 to 1.8. That ain’t fun. The only thing I was able to find is a Guide to updating to 1.7.
Upgrading Python from 2 to 3
Of course the first step to any change like this is creating a new virtual environment and branching your CVS. Since I’m moving to py3k, I’m going to use the built-in pyvenv
. There are some arguments for using the good old virtualenv
, but I’m trying to keep it as clean as possible. Also, update your requirements.txt
so that it pulls the latest version of addons.
There’s a good guide to moving from Python 2 to 3. Since I’m not going to worry about backwards compatibility, I can just run 2to3
and rename all of the functions. You can’t do it first and then test because 1.4 doesn’t have any py3k compatibility, but it’s so simple that you can do it at almost any point.
Actually upgrading Django requires taking a look at 1.5, 1.6, 1.7, 1.8. This is what I call obnoxious. The entire point of writing this is so that we can consolidate all of the changes that need to be made in one place with simple language step by step directions. Let’s get into it.
Changes to settings.py
- Templates is now a list of backends with some settings for each. While this isn’t necessary for right now, it’s going away in 1.11.
- ALLOWED_HOSTS is now required
- Many settings have been removed. Look through your settings file and find what they’ve been changed to.