Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Django, the view from a parachute

In the last few days I have been learn­ing Djan­go in per­haps the hard­est way pos­si­ble: by be­ing hired to work on a site some­one else wrote.

I al­ready had the view from 10000 feet. And since I had to get to this thing rather quick­ly, I jumped on my para­chute from those 10000 feet, and learned it on the way down.

Here's what I knew:

  • Python Web frame­­work

  • Reg­ex­p-based URL dis­­­patch­ing

  • Its own tem­­plate lan­guage

  • Its own ORM and form stuff

I have hacked stuff based on Tur­bo­Gears, Col­u­brid, pure Cher­ryPy, Mako/Kid/Chee­tah/Cher­ry­Tem­plate tem­plates, Routes, Paste and about half a dozen oth­er frame­works or pieces that are used for frame­work­s, so how new could it be? Well, not very new. I am start­ing to no­tice a sort of same­ness in these things. They are all alike.

First, the con­clu­sion: I liked it, I could work with it.

Now for some lit­tle de­tail:

  • The URL dis­­­patch­ing is nice ,if not re­al­­ly in­­ter­est­ing. there seem to be two ways to do this, all frame­­works use one or the oth­­er, and al­­most ev­ery­one likes reg­ex­ps bet­ter.

  • The OR­M+new­­forms is quite nice! Of course ev­ery­thing was done with old­­for­m­s, which is... not quite so nice. But you can switch pieces as you go, and the code ac­­tu­al­­ly sim­­pli­­fies as you hack, so it's good.

  • The tem­­plate lan­guage I could live with­­out. It does­n't seem to be spe­­cial­­ly fea­­ture­­ful, and it did­n't seem as ex­pres­­sive to me as my cur­rent favourite, Mako. Luck­­i­­ly you can re­­place it eas­i­­ly. It's not that it's bad, it's just av­er­age.

So, I see no rea­son to learn it in­stead of Tur­bo­gears, or vicev­er­sa. On the oth­er hand, if you know one, you can learn the oth­er in per­haps a week­end, so there's no point on not hav­ing at least a ba­sic knowl­edge of both.

Jeff / 2007-08-14 16:09:

The Django templating system is designed for designers more than developers, hence the reduced expressiveness. I like the filters in the templates, since it reminds me of Unix pipes. The reduced expressiveness also makes it hard to stick application logic inside of the templates. I've used Spyce, plain CGI, TurboGears, and Django. Django has two big selling points (for me, anyway): the admin utility and good docs (this is a sore point for a lot of open source projects).

jfx32

Roberto Alsina / 2007-08-15 00:05:

Yes, the admin tool is great, and the docs are good, or at least better than the competition's.


Contents © 2000-2024 Roberto Alsina