Upgrading to Django 1.3

Moving mpdaugherty.com from Django 1.1 to 1.3 was much easier than I feared.

Overall, the djangoproject website has pretty good instructions for upgrading Django. Just uninstall any previous versions and install the new one. Yep, it’s that simple.

Of course, there’s always a little more to it, though in this case, not much. First, check for any backwards incompatibilities that will affect your program by reading the Django 1.3 release notes. I didn’t find anything concerning when I upgraded my sites.

Next, find your django installation (on OSX, it’s /Library/Python/2.6/site-packages/):

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(); import django; print django.__path__"

If the second line is an absolute file location (starts with ‘/’), that’s where Django is. Otherwise, that’s the name of the subdirectory in site-packages (the first line) that contains django.

Go to that directory and get rid of your current Django install. I chose to save mine just in case, so I just moved it:

sudo mv django django-1.2

Next, do a standard install of Django 1.3:

wget http://www.djangoproject.com/download/1.3/tarball/
tar -xvf Django-1.3.tar.gz
cd Django-1.3
sudo python setup.py install

Then restart your development server. Anything in your code that’s deprecated should cause a warning. I got:

Validating models...

/Library/Python/2.6/site-packages/django/db/__init__.py:19: DeprecationWarning: settings.DATABASE_* is deprecated; use settings.DATABASES instead.
  DeprecationWarning
/Library/Python/2.6/site-packages/django/db/__init__.py:60: DeprecationWarning: Short names for ENGINE in database configurations are deprecated. Prepend default.ENGINE with 'django.db.backends.'
  DeprecationWarning
0 errors found
Django version 1.3, using settings 'flother.settings.development'
Development server is running at http://127.0.0.1:8000/

Fix the errors & restart. All done!

Written by Mpdaugherty on Friday, 15th April 2011.
Posted in: Django

Next: Using git through a proxy 4 days, 15 hours later

Previously: Big decisions - the Engineering approach 1 week earlier