I attended a pretty good Django demo today put on by MSI. I've been writing apps in the grails.org framework for a couple years now, and I remember looking django over before I started using grails, but not in enough details to be able to do a decent comparison.
Now that I feel rather confident using the Grails framework, I wanted to see if I chose well, and if I should have picked Django. I was a bit worried about discovering that I'd made a bad decision, but I really wanted to know.
The demo I went to today was only two hours, so I am not by any means an expert on Django. These are merely observations I've made while driving past it at 70 miles per hour.
The first thing I'd like to say is that because Django is all in python, the command line scripts are fast. I mean really fast. I'm used to 5 - 10 second runtimes for grails commands. Running an app can take up to 15 seconds on a Intel Core 5 processor. Python screams here.
The second thing I notices about Django was that it can handle multi-tennancy out of the box. I can create one Django site, and host many different apps within that single config. This is something that I've never been able to do with Grails, but have wanted to do. Kudos to Django.
Now for why I am glad that I went with grails. It can be summed up in one statement. Structure. Grails is structured very well. It keeps it's templates, controllers, views, domain classes, scripts, tests, etc all in a very logical folder structure, and uses that structure to execute some very nice DRY (don't repeat yourself) configurations.
Django is very loosely structured. The controllers can be in the same folder as the domain classes as the services as the plain old class files. This means clutter, this means configuration files, this means boiler plate code.
In grails, if I have a controller named BookController, that will by name map to a book/ view and in turn have BookTest unit tests, and the url http://.../myapp/book will map to that controller by default. Django needs quite a bit of configuration to make that work. That's code that I need to type, and I don't like to write code that I shouldn't have to.
Another area I like regarding Grails is it is build on top of enterprise Java systems. What does this mean. Well, under the GORM hood is Hibernate, and with a few lines of code, I can map my really cool Grails domain classes to a nasty old MSSQL database structure. That seems to be rather difficult to do with Django.
These are a few things that caught my attention. Don't let this dissuade your from using Django though. If you are a python programmer writing web apps, USE DJANGO! Please. You should be using a framework, and Django is it for python. If you are language agnostic though... so far I like Grails the best. I have yet to see a good Yii demo or CakePHP demo, so if anyone out there is a PHP framework guru, I'd be interested in seeing some cool PHP code-fu.
P.S. If you write U of MN apps and want to use Grails, let me know I have some plugins for you. Authentication and Web Templates are the two big ones.
Please tell me if I mis-judged Django. I want Django to be awesome. I really do.

Leave a comment