Just Landed

An Outsider’s Perspective From The Inside

  • About Just Landed

    Just Landed is a part of the ever-expanding Blandings Media Empire.
  • Write Me

    justlanded AT blandings DOT com
  • Archives

  • Categories

  • Advertisements

Django/Google App Engine Templates: Disappointed

Posted by anandrr on July 21, 2008

We spent the weekend playing with the Google App Engine. Our goal was to write two applications by the end of the weekend, one of which was to involve Facebook and this humble blog. We were stymied badly. And we blame the templating system.

Google App Engine itself is quite brilliant. It’s Django dressed up with a “Google data store” and instant uploading and deploying of applications. It’s a great way for start-uppers to write and deploy apps and see what sticks. As such, we approve. We’re not yet certain what the various quotas mean, and how they affect someone seriously trying to build an application on the Engine (500MB of data storage seems ridiculously small), but we’ll figure that out when we get to it. After all it’s free.

However, we don’t like Django’s template system. We’re told we can stick any template system we want, and that we are not restricted to using Django’s system. But that is what we got to start with, so that is what we used. Mostly, we didn’t like that we couldn’t have complicated logic in the template, and any time logic was involved, Django would relegate it to the business logic layer. This isn’t always true. Presentation layers sometimes do have logic embedded in them. This is what makes presentation interesting. Requiring the business layer to pre-compute all the logic that the presentation layer might need seems silly. Django puts it all down to their “design philosophy.” Sometimes though it looks like design deficiencies masquerading as philosophy. The entire template system seems to run on a regular expression engine. This is great for speed, but sucks when you want any form of recursive evaluation. They seem not to want a PHP like language, but we like our PHP like languages. We aren’t arguing that all of our business logic should go into the presentation layer, but we would like to have the flexibility to choose which of our logic is business and which of it presentation. PHP straitjacketed one into putting all one’s logic into the presentation. Django takes the opposite approach and puts all our logic in the business layer.

We speak with some experience in this area. Back when Python had just modpython and some primitive application and template engines, we picked up an open-source system and extended it quite a bit to roll our own application engine and template system. We used this to write a fun side project at the time and the original front-end to our company’s product. We wrote both of those with clean separation of business logic and presentation logic. But, hark! It is still used to run the famous debug tool at our company. This tool was written by someone who had no time for business logic, so they wrote it all into the presentation layer. They had this flexibility precisely because the presentation layer was as powerful as Python. This has led to a somewhat unmanageable product, but at least it allowed for rapid development and deployment.

All in all, we wish the Django authors had not been so dogmatic. Twice we had to rewrite our business and presentation logic just to get around silly limitations in what the templating system permitted us to do.


4 Responses to “Django/Google App Engine Templates: Disappointed”

  1. Did you try writing any custom template tags? 9 times out of 10 I find that limitations of the template system can be solved by clever application of a custom tag.

  2. Roy Prins said

    This review seems a missed opportunity. As you said, the template system is optional and there are strong arguments to be made in it’s favour. You could have used any other in less time than it took to write this review. How is loose coupling dogmatic? Except that is favours all dogma’s concerning freedom and ease of choice.

    I am sorry not to learn more about the combination Django – Google App, would have been very interesting and topical.

  3. ibrahim binshahbal said

    nice article.

  4. Hi,
    I totally love your article!! Good piece of work on the web site design.
    Bye for now..!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: