Why I Love Django

I’ve used Django for a few small projects in the last year and have absolutely fallen in love with it. While I always insist that I’m not a language or framework zealot I will quite happily and unashamedly push the Python / Django team wherever possible. Here are some of the reasons why.

Pythonic. This is a term that has evolved with Python to basically mean compliance with the Zen of Python. Here is the Zen of Python in its entirety as provided by Python.org:

    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the temptation to guess.
    There should be one-- and preferably only one --obvious way to do it.
    Although that way may not be obvious at first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right* now.
    If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea.
    Namespaces are one honking great idea -- let's do more of those!

It just so happens that this aligns perfectly with the way I think. This is what drew me so quickly and intimately to Python itself.  It’s one of those things that makes a language “feel right” to us.  Every time I read the Zen of Python I find myself nodding profusely and grinning cheekily.  Django is Pythonic.

No black magic. Django’s components provide everything you need, but don’t go away and do anything so mystical that you can’t quickly get a handle on what’s going on and what their thought process may be.

Fantastic, complete documentation. The documentation on the Django website is well-written, complete and up to date with abundant code examples.  I really can’t stress the importance of this enough.  Anyone who has spent hours trawling through useless, incoherent, incomplete documentation will immediately see the value in this.

It’s ready when it’s ready. The Django developers are not afraid of holding back on a release if it’s not ready.  Django 1.1 was released about 3 months later than it was intended and the developers had no shame in holding it back because it wasn’t quite ready.  I highly respect them for this because it means that we can fully trust new releases to be very stable with copious amounts of polish.

Stays out of the way. One of the things I respect most about Django is that it doesn’t get in your way.  While it provides a complete stack for everything from data model handling to view templates you are free to substitute components with any of your own.  Don’t like the built-in authentication mechanism?  No problem.  Plug in another one or write your own.  Django’s concept of “applications” (basically pluggable modules) makes this easy.  Want to use your own file storage mechanism instead of what Django provides?  You’re more than welcome.

Built-in caching. Django was designed from the ground up with caching in mind and not only provides its own caching mechanisms but also plugs into existing, tried-and-true caching mechanisms like memcached (used by Facebook).

Easy admin interfaces. Django comes with a fully customisable admin interface for your projects which will hook directly into your data models.  This allows you to concentrate on developing your end user views without having to first get data entry forms in place.  Of course there’s no reason why you can’t continue to use the built-in admin tools or allow portions of them to be used by your end users.

Sane templates. Django’s templating system is just plain sexy.  It’s got the lot: fully-featured tags, batteries-included filters, and very simple, Pythonic, easy-to-learn syntax.

I could go on.  Apart from all that I’ve just mentioned, Django is also backed by Google and has the stamp of approval from Python’s creator himself, Guido von Rossum.

Not convinced?  Just take a look at the vast array of sites being created every day on djangosites.org.

One response to Why I Love Django

Agreed. Every time I’ve tried a new framework I feel like i’m learning, “their way” of doing things.

With Django I was like, yeah wow omg this this makes sense, but it’s also convenient and fast.

Leave a Reply to Steve Cancel Reply

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