What I Did With My Weekend
My IM status, yesterday
I’ve recently been working on a project that exposes a simple web service. When I first wrote the web service last year, the best option to connect Python code to the web had seemed to be mod_python. So I’d knocked up a couple of scripts that parsed URLs and generated POX in a vaguely RESTful manner. Good enough for a prototype.
But now there’s lots of ideas swirling about how this could grow, so I needed something a bit more manageable/scalable/enterprisey.
Earlier this week, I saw the news that there was a new release of Django, a Python webapp framework.
So on Tuesday evening I ran through the tutorial, and thought “Oooh!” In much the same way as when I first used the ElementTree XML interface, I had that feeling of “Wow. Finally a framework written by someone whose brain works in the same way as mine.”
I think that’s a good thing.
On Friday, I converted the webservice to use the Django API instead of the mishmash of intertwingled SQL calls it had been. It all worked a treat. Hurrah!
And then over the course of the weekend, I’ve been hacking away, creating a website around my webservice.
Of course, Django’s not perfect. But reassuringly, as I find “holes” and Google for them, I find that there’s plenty of thought being given to them on the Django mailing lists. For example, when I noticed that it wasn’t encoding user-inputs, thereby making it really freaking easy to accidentally expose your site to XSS attacks, I was disappointed. But then I found Simon Willison’s plan for AutoEscaping, along with associated mailing list discussions, and was reassured that this is being thought about, and in a way that will help avoid another magic_quotes-style farrago.
I’m really excited about moving forward with this project, and seeing how far I can stretch Django. If you’re not keen to learn Ruby just to get on Rails, then Django’s a good way to go.