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/base.py" in get_response
77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/site-python/django/contrib/admin/views/decorators.py" in _checklogin
55. return view_func(request, *args, **kwargs)
File "/usr/lib/site-python/django/views/decorators/cache.py" in _wrapped_view_func
39. response = view_func(request, *args, **kwargs)
File "/usr/lib/site-python/django/contrib/admin/views/main.py" in change_stage
329. new_object = manipulator.save(new_data)
File "/usr/lib/site-python/django/db/models/manipulators.py" in save
163. if rel_new_data[related.opts.pk.name][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.

http://code.djangoproject.com/ticket/3519

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 πŸ˜‰

Posted in Uncategorized
2 comments on “Django we have a problem
  1. Anonymous says:

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

  2. Dan says:

    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

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload the CAPTCHA.

May 2007
M T W T F S S
« Apr   Jun »
 123456
78910111213
14151617181920
21222324252627
28293031  

I paid up to protect your bits. Open Rights Group.

Creative Commons

Creative Commons License
Unless otherwise stated all work is licensed under a Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.