~hruske Hruške, jabuke, jablane, čežane. » Blog Archive » Why Django?
Home Contact Sitemap

Hruške, jabuke, jablane, čežane.

Ste se gdaj vprašali, zakaj Najboljšega soseda nikoli ni doma, ko pridete na obisk?

Why Django?

Posted on November 4th, 2006 in django, pootle, python |

There have been numerous questions on Pootle mailing list as to why choose Django and not something else. I’ll try to post some answers here too.

Django has great error (debug) page. It is very helpful when developing applications, in fact I think web.py has copied the thing. If I was Guido, I’d probably suggest putting this right into traceback module.

Django is explicit. Most of the stuff in Django is declared explicitly. There is as little “magic” as possible and all imports are explicit. While this may be a little hard to get used to, if you come from CherryPy, it’s in fact very good. This way you know exactly where to look for a specific function, since you already had to import it. Also, with less magic Django is more open for developers.

Django is built for speed. Even if written in Python, all the functions are written with performance in mind. The values are evaluated only if they’re accessed, the queries to the database are only made if you access the contents of the query. So if your page takes time to load, it’s most likely there’s something wrong with your code.

A framework should stay out of your way. Because Django was built with speed in mind, it also means you don’t need to optimize the framework, so it stays out of your way. On the other hand, it is sometimes annoying to figure out what to import.

Sensible templates. Who cares about technical supremacy, if it’s incomprehensible? I’ve seen a bunch of people trying to figure out details of Kid templating. And the Kid errors are just as incomprehensible as the template language. Christian Lenz then reimplemented a templating engine very similar to Kid, called Genshi, but it does not appeal to me. While it may be technically supreme from both Django’s templates and Kid templating, that still isn’t the reason for me to embrace it. To me, it just seems complicating things that needn’t be complicated. The one thing I am still on the lookout for is template inheritance in Kid; does it even support top down templates?

Neat and powerful URL resolving. Django has really good, regular expression based URL resolving thingie. It’s nothing like the class tree in CherryPy 2, but is a bit similar to RoR routes (or a Python implementation used in CherryPy 3), except it again isn’t that complicated, since it does not feature conditionals on cookie, HTTP method and similar routes features.

That probably wraps some reasons, but surely I could find some more. Better get back to coding.

One Response

  1. jankoM Says:

    Hmm.. if this is true then Django is interesting. I had it for yet another framework and I am not too fond of frameworks. Some points you mention are the one that are cruicial to me so I will prob. look at django when I have time.