Django as superego

I built a toy site using Django’s “generic views” last night. Basically this means that for the first time I created an app without writing any real code – I defined a model, wrote some rules mapping URLs to Django’s generic view functions, and made some templates that get called by that view code (I spent most of my time fussing with the templates!).

This would have been pretty easy to hack up in PHP, too, but there are lots of things that would have been just as easy to not do the “right” way – things like clean URLs everywhere, redirect-after-POST (to avoid multiple submissions), custom error pages, a polished admin for inspecting and editing the data, nicely modular templates. Django made it easier to do it right than to do it wrong.

The site is a “pastebin” app, so as a bonus it gave me a convenient way to share the source. Insert pro forma apology about quality of code here.

http://paste.e-scribe.com/


Dagur commented on Wed May 17 07:29:22 2006:

Very handy! Now I just wish gedit and/or pydev did syntax highlighting like that.


Panos commented on Wed May 17 14:41:02 2006:

Plain and simple. I like it. I couldn’t have thought it would be that simple to make a pastebin with django.

Then again, all you gotta do is try, as you showed us :)

Thanks for food for thought.



Share: