Until last week I had never heard of Django, a web framework written in Python. I'd seen python before, but had never really tried it out - I could do everything I wanted to do in PHP, and having libraries such as Smarty available to me solved all my problems.
Or so I thought.
I thought I'd give Django a shot as I'd seen it touted as the Ruby on Rails killer in Python. I downloaded it, installed it on UGBox, enabled mod_python and walked myself through the Django tutorial. Not 15 minutes later I had a working application, but I'd written bugger all code.
This inspired me. Django has a publishing background - it was originally written for use by a number of newspapers and websites in Lawrence, Kansas. I've been working on a website for a little while now (which is still not live - it'll be ready soon, and is aimed at Blokes in Australia) which follows a similar publishing model - articles, authors, categories, comments... pretty straightforward stuff.
I got to work writing a simple data model in Django during my lunchbreak last Friday. In one file I set out some basic details for my database - Django makes this so easy it shouldn't be allowed - after creating a simple model, Django automatically initialises the database and creates the appropriate fields.
Once the database was in place, Django's flexibility really sunk in. I installed the 'admin' application that is included with Django - and my world was turned upside down. Instantly, a beautiful back-end admin screen was built for me to add articles, link them to categories, edit data, create data, and more. After 15 minutes writing up some templates, the public side of the website was done - and I had a fully operational news publishing website in less than an hour.
At this stage, the website was functioning identically to what I'd already written in PHP - except the PHP code took me a month to write, and this took a lunchbreak. Why hadn't I discovered this in the past? Obviously I need to do some cleaning up, but the core of the application is there, and it just works.
Next on my little todo list, to get my hands-on experience with Django increased, I decided to write this blog. I did this over my weekend - and noticed something funny. For this entire blog, the only bit of code I wrote was the data model, and then some paramaters for the RSS Feeds. No logic was needed, no data fetching, no linking - just a few tags in my templates to make everything show in the right place. Un-friggin-believable.
I'll be posting some of my code up shortly to show how simple this stuff really is, with such amazing results. Until then, I'm off to convert a few more of my little PHP apps into Django - in the meantime I suggest everybody who writes web apps should check out the Django tutorial today.
Last drinks. The end of the road. The last page. End credits.
Thanks for reading.
© Copyright 2006- Ross Poulton. All Rights Reserved unless explicitly defined.
Opinions expressed here are my own, and not those of my employer or any other party.