A First Look at Django

12 PM June 27, 2006

I just finished the four-part Django tutorial, and I’m impressed. Here are my initial thoughts:

  • Django’s full API + shortcut API philosophy shows all the signs of being put together by experienced programmers who eat their own dogfood.
  • Django’s model layer has much the same feel to as SQLObject. I wonder if there is some shared heritage there.
  • I can see why Jeff Croft, the non-programmer, likes Django. It imposes very few requirements on the structure and content of web pages, allowing web designers to build whatever they feel is appropriate.
  • The automagic admin pages feature is brilliant. No more having to choose between delivering without UIs for the reference tables, and spending half the project budget writing pages that are only going to be used twice a month.
  • The list of generic views is interesting. I can feel yet another version of my weblog coming on.

Some neat Django features I’ve yet to explore:

It’s impossible not to compare Django with what I know of Rails. So far, it would appear that Rails has two features Django does not:

  1. Django does not generate default page templates. It expects me to code all the HTML myself, from scratch. I suppose this is not a big deal as most applications would neat custom HTML anyway, but it would be nice to have a simple base to work from.
  2. Django has no integrated AJAX. Writing an AJAX enabled Django app wouldn’t be overly difficult, but it would be nice to have a bit more support built-in.
By alang | # | Comments (5)
(Posted to Python and javablogs)

Comments

At 07:15, 28 Jun 2006 Andy Todd wrote:

And the thing that struck me in my recent django learning (which is probably just me reinforcing your first point) is that whenever I tried to do something that wasn't explicitly mentioned in the tutorial the obvious (at least to me) solution worked.

Getting to grips with django feels very much (to me, at least) like using a Mac. Things just work.

(#)
At 11:52, 28 Jun 2006 yml wrote:

Hello,
Regarding the features that you are missing in Django. I would advise you to have a look to the link below:

http://code.djangoproject.com/wiki/ScaffoldScript

This should help you to get started with your form.
I hope that helps.

cheers,

(#)
At 19:21, 29 Jun 2006 Nick Efford wrote:

Work is underway to integrate Dojo with Django, addressing your second point.

(#)
At 15:21, 30 Jun 2006 Jacob Kaplan-Moss wrote:

Thanks for the write-up! I hope you continue to be impressed as you dig deeper :)

So Django's ORM doesn't share any code with SQLObject, but many of the features were directly inspired by it. SQLObject is a great bit of code, so we "borrowed" quite extensively.

(#)
At 04:45, 23 Apr 2007 Jeff Croft wrote:

Great write-up, indeed!

I would assert that the two missing "features" that Rails has and Django doesn't are missing by choice, and not things the Django community at large is looking for from its web app framework.

Code generation seems like it's almost always a bad idea, and Rails scaffolding is rarely useful in practical use. As you said, custom HTML is always needed anyway. However, as someone else pointed out, there is a Django plug-in of sorts that gives you scaffolding functionality if you really need it.

Django is a back-end framework for creating the server-side portion of web apps. It is not in the business of writing JavaScript. Django gives the front-end developer/designer the freedom to choose between any of the plethora of great JavaScript libraries for AJAX and related functionality, rather than prefering one over the rest, as Rails does. Django does, of course, provide serialization of database objects into XML and JSON for use in your AJAX apps. In other words, Django does fully take care of the back-end portion of doing AJAX -- but it leaves the front-end portion up to a front-end framework of your choice (or, write your own!). For me, this is a feature, not a bug. I don't want to deal with Dojo. I don't want to learn Prototype. I want to use YUI. But if you want to use Dojo, then you ought to be able to without feeling punished for not using the JavaScript library the framework prefers. Also, Rails' default setup is to write nasty, inline JavaScript, which goes ganist everything we've come to love about unobrustive DOM scripting. I, for one, am glad Django doesn't go down that path.

Flexibility rules.

(#)

Add Comment




(Not displayed)






(Leave blank line between paragraphs. URLs converted to links. HTML stripped. Indented source code will be formatted with <pre> tags.)




© 2003-2006 Alan Green