Toying with Django

As you know, I've been spending some time learning turbogears, and think it's pretty damn good. However you can't do any work in python these days without hearing about Django. So, I thought I should at least take some time to evaluate it, and see how it compares with what I already know. Luckily, 0.96 (the latest stable release) is already packaged in gutsy, so it was trivial to install. 

To go about testing it, I endeavoured to rewrite the backend to badrunner.net using django, and also replace the wordpress instance with a custom blog. Note that replacing wordpress is not anything to do with a dislike of that great software, its merely so I can exerciie my django skills.  I'm also currently working on a website for my cousin which should be up at lennardwoodcreations.com in the near future, and have chosen to use Django for this site too.

The Good

So what's good about Django?

The automatically generated admin interface. This feature alone is wow with a capital w! This is the primary reason I have opted for django over turbogears for my other project.

Regex url matching

The flexibility here is staggering, and it gave me an excuse to really try an learn pythons re syntax, whereas I'm normally lazy and just cheat with string functions. I honestly believe (and advocate to my friends) that any programmer worth his salt should learn to love regular expressions, and here I'm eating my own dog food as it were.

Generic Views

Trivial redirection and 'static' file template rendering, fantastic. The object list and detail setups are nice to. Again Django excels at making the easy easy, and the hard possible.

The Bad

NIH Syndrome 

One of the drawing factors to turbogears for me, is that the project tries to simply be a layer on top of the best of breed tools. I like that you can relatively easily replace your ORM, or your template engine, or whatever, yet still have great defaults to use. The only downside to this in turbogears is that for developers using a 1.0.X release, you know that all the major components are being changed for 2.0. The reasons the turbogears project are doing this are sound, but its annoying to think tech that you are already using has been deprecated.

Django on the other hand, uses virtually nothing from anyone else, and so reinvents the wheel for every supplied component. Again, their reasons for doing this make (or at least made sense when django was first being developed), but it does mean its hard to replace any component, and you lose alot of the niceness of django if you do.

Strictly speaking this isn't necessarily a bad thing, but I do get the impression that this will (if it has not already) lead to unnecessary wheel reinventing, possibly producing something lower than the standard of what already exists.

Template Language

I simply just dislike the template language of django. It does offer all the features I want, it's just that i dislike the syntax.

Initial Configuration

There are more steps to setting up a django project, due to the 'site' and 'app' separation. This is fine, but when starting out it seemed like i had to do more to get django to give me a result than turbogears. However, now I know a lot more about it, I much prefer the flexibility offered, so perhaps this should be in "The Good".

Summary

Anyway, I think the admin interface building alone is a huge boost in favour of Django. It's not hard to write replacements, but the reason you use something like this in the first place is to do as little work as possible. I currently would use django over turbogears for any project where I can make that choice, however I'm looking forward to turbogears 2.0 as i think this may be a fantastic release.