Django we have a problem

As you might know if you read this regularly I’ve been doing quite a bit of work in Django recently, it’s kinda like Ruby On Rails but for Python and in my opinion it’s better. It doesn’t have the media buzz that ROR seems to get but I think it could be big in the next few years. It’s free and it’s Open-Source, what’s not to like? Google have even started using it and that can only bode well.

I’ve been building some test projects with Django for a while on Ubuntu Edgy but when I moved to Feisty a couple of weeks ago I noticed some errors starting to crop up and I was worried when I was greeted with this message on a site I had tested and knew worked fine under Edgy:

Traceback (most recent call last):
File "/usr/lib/site-python/django/core/handlers/" in get_response
77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/site-python/django/contrib/admin/views/" in _checklogin
55. return view_func(request, *args, **kwargs)
File "/usr/lib/site-python/django/views/decorators/" in _wrapped_view_func
39. response = view_func(request, *args, **kwargs)
File "/usr/lib/site-python/django/contrib/admin/views/" in change_stage
329. new_object =
File "/usr/lib/site-python/django/db/models/" in save
163. if rel_new_data[][0]:

IndexError at /admin/news/entry/1/
string index out of range

It seems that this is a Feisty specific problem so I decided to do some hunting and see what I could find out. Thats when I came across this on the Django site.

It seems this problem is caused by the version of Python packaged with Ubuntu 7.04, it’s version 2.5.1c1 and according to the site it can be fixed by either upgrading to Python 2.5.1-Final or downgrading to 2.5.0, which sounds great but it didn’t work out quite like that for me. I got the newest version of Python and compiled it from source. All seemed to go well at first and I felt pretty good but thats when it all started to unravel.

I tried to run a Django project and found that my new installation of Python didn’t know what Django was. No problem I thought I can just re-install Django and it will all be sorted. However, it didn’t work and I also started to notice problems with other programs too, Rhythmbox plugins stopped working and so many other things I can’t list them. Python is the core language for many applications in Ubuntu and I realized messing with it was not a good idea, hindsight’s a bitch isn’t it?

(one of my many python errors)

So whats the point of this story? Well it’s this. If you get this Django problem on your Ubuntu Feisty machine, don’t mess about trying to upgrade Python from source whatever you do. There is a workaround fix which works great, you can wait and upgrade Python when the Ubuntu developers have packaged and tested it for you. Thats what I should have done.

So after many attempts to revert my Python back to the default Feisty version I’m waving the white flag and reaching for the Ubuntu CD to re-install my system. It’s not as bad as it sounds really, I can keep all my data and settings, I’ll be done in 10 minutes probably (fingers crossed) but it’s all hassle I could have done without. I’ll install Django, apply the hack and get on with some long overdue work. I still love Django though, just don’t what I did ok πŸ˜‰


  1. As always there is at least one
    other possibility. You might install python2.4 additionally to python and use “python2.4 runserver” for testing your projects.

  2. Yeah thats a good point and I didn’t think of that, Edgy used Python 2.4 and I know it worked on that. Like you say there are always 101 answers to these problems. Thanks for the info πŸ™‚

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.