Upgrading Django on Ubuntu Linux

As I wrote on Twitter a couple of times, I’ve been exploring the world of Django during the latest few weeks. I’m quite impressed with the framework, although there are some issues I’m not yet used to. This post is a short snippet for the Ubuntu users that are struggling with upgrading to the latest Django package. I’m not sure about other Linux distros, but the latest Ubuntu installs django 1.1 which is quite old nowadays. So if you’ve installed Django the following way on Ubuntu:

sudo apt-get install python-django

You’re probably running an outdated version too. Now, to fix this you’ll have to get something newer as a tarball package from the Django Download section and follow the install instructions, which basically run the python setup tools to install the package. After everything’s done, there’s just one minor issue. You have to remove your old django installation as it has a higher priority for python. Use the following code to remove your old version:

sudo apt-get remove python-django

Also note that django may be left somewhere around /usr/local/lib/python2.6/dist-packages/ so make sure you remove the outdated versions from there too. Then run the python interpreter and print out the current version of Django. Make sure that you see something similar:

import django
django.VERSION
# Outputs: (1, 2, 3, 'final', 0), hurray!

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.

3 comments