I’ve thought it would be useful, both professionally and just for fun, to know a bit wider array of frameworks, libraries and other stuff related to web development, and last week it was Jaxer time. Now, I’ve got my hands on Django, a Python-based web framework.
I’ve always liked Python – The syntax is refreshingly different, and some of its features remind me of JavaScript’s good parts. In the past I used Python to write the server application for TankWar Online, the first ever (as far as I know) JavaScript-based game with online play capability.
Start
When I first used Python, I really liked it. It just somehow… was so fun and easy to use. Django is the same.
I’ve looked at Pylons, which is another Python web framework, and it seemed like a mix and match soup of components. Django on the other hand has its own implementations of things, and looked much more like a complete package.
Getting Django up and running on a development server is easy, as long as you can follow written instructions. It will be a bit simpler on Linux/Mac, as it’s likely that you already have Python installed on those OS’s. I’m testing it on Windows, and outside a minor problem with the initial installation, it’s worked like a charm.
The next thing you notice is how amazingly quickly you can set up a site with a full fledged admin panel. You only need to define your models (Django is loosely based on the MVC pattern) and Django can do the rest. It will generate the database for you, and by enabling a bundled app, you get a full automatically generated admin panel for it – complete with nice and easy add/edit/remove for your database tables.
Model View Template?
Django’s terminology differs slightly from MVC: Controllers are known as Views and Views are known as Templates.
The ORM provided by Django is quite extensive: You get column types, validation, foreign keys, many-to-many relations… all in all, it’s a very powerful library.
The templates are a bit different story. Comparing to PHP, you need a parser for them, since you can’t embed Python code to HTML like you can embed PHP. The template syntax is nice, but it may at some point cause problems if you need to do something that the parser doesn’t let you. Do note that I haven’t used Django very much yet, so I don’t know for sure if there are any gaping limitations.
Compared to say, Zend Framework, Django is quite restricted. You don’t get as much flexibility as you get with ZF, but you won’t be writing as much code as you’d be writing with ZF either. Front controller? What’s that?
A great framework
All in all, by the initial testing and stuff I’ve been doing with it, Django seems like a very solid framework. If you want something that will get you up and running pretty quickly, it’s definitely worth checking out.
There’s also tons of more advanced features I haven’t yet played with, like generic views, internationalization, caching, add-ons, etc…, so head on to the Django site to get the whole picture.