Sunday, November 9, 2008

Carefully Upgrading to Django 1.0

I’m a little behind, but I finally upgraded my family website to Django 1.0. First of all, I wanted to keep the main site running my older version of django from subversion while having 1.0 installed and being used by the development version. First I added the old install to my apache configuration’s PythonPath. Here’s the diff:

-   PythonPath "['/home/bryan/web/murdockfamily'] + sys.path"
+   PythonPath "['/home/bryan/web/django_src', '/home/bryan/web/murdockfamily'] + sys.path"

Then I deleted the symlinks to that django install from any site-packages locations:

sudo rm /usr/lib/python2.4/site-packages/django /usr/lib/python2.5/site-packages/django /usr/local/lib/python2.5/site-packages/django

Then reloaded apache:

sudo /etc/init.d/apache2 reload

And it seemed to still work.

Next I untarred Django 1.0, and installed it:

tar -zxvf /home/bryan/downloads/Django-1.0.tar.gz
cd Django-1.0
python build
sudo python install

I restarted apache again at this point to make sure the production site was still running. Thankfully, it was.

Then I started up the development server in the development branch of the family website and saw it fail while trying to use Django 1.0. Sweet. Just for sanity’s sake I did this to make sure it still worked with the old version:

$ PYTHONPATH=/home/bryan/web/django_src ./ runserver
Validating models...
0 errors found

And the world is still sane. The next step, of course, will be to fix those errors I got when starting the development server with Django 1.0. I’ll let you know how that goes.

No comments: