Google App Engine: Templates

Posted by greg Thu, 08 May 2008 17:51:00 GMT

Google App Engine comes with Django templates support built-into the framework. All I can say is, WTF? Fundamentally, I believe in clean separation between display and logic. But what I have a problem with is the Django philosophy that python has no business inside the template. What? I can understand this thinking if you hired a bunch of retards to code your application. Bad things can happen to kids with no supervision. But come on! This is fascist. I believe your framework should work for you and not the other way around.

After digging into Django templates for a few weeks, I decided it wasn’t for me. Too much of my time was being devoted to writing custom tags which eventually would be replaced with python during the template compilation. I surveyed what else was out there. Right now, I’ve chosen to use Mako templates for the one simple fact: life is too short to deal with an extra layer of bullshit.

It appears using mako’s template caching with GAE is a no go, too. But this is a GAE thang since it doesn’t allow writing to disk. However, you can write python in your templates. I use Cheetah for building pages at my work. It’s pretty good, too. It has its quirks and from what I’ve read, it also works with GAE with minimal monkey patching.

One other thing I find odd with python web development is having to explicitly render a template and bind all your variables to in the first place. But this is also just me getting used to the pythonic way of life. This is just something I’ve taken for granted with .NET and Rails. There’s got to be a way to remove this extra step for every python controller action I code from here to eternity.

So there you go my devoted faithful… Learn it, live it, code it.

Google App Engine is GAE

Posted by greg Tue, 22 Apr 2008 20:23:00 GMT

I’m sure you’re aware of the recent release of Google App Engine? Yeah, it’s GAE. I signed up and received a free developer account the minute the ‘open for business’ sign went up. I’ve been tinkering with it ever since.

Google App Engine makes prototyping and hosting a spray-and-pray website (you know where you throw some shit(es) at the wall to see if they stick?) super easy. Currently the limitations on the service while they continue to fine-tune the gears and cogs are adequate enough to see if you have a hit on your hands. The integration with the existing Google user-base is worth it to me alone. If this eventually works with OpenID then I’ll take two.

On the other hand, I’m also a little skeptical about giving Google all the keys to your castle. You know? If they managed to rip campfire off to showcase App Engine’s potential, what’s stopping them from taking your code and slapping a beta sticker and ‘g’ in front of the name?

App Engine supports Django templates and form submissions. I’ll let some Django-istas talk about how well this works or doesn’t since this isn’t a framework I’m super familiar with. My Python skills (or lack of) are currently only at best a yellow belt level. I know, I hear you saying, ‘Sweep the leg Johnny! Sweep the leg!’ I’m working up to that part.

One of the first things I’ve started to play around with is adding Rails-style routes. ‘Uh, why don’t you just use Django and be done with it?’ On one hand, I’m not looking to reinvent the wheel but just adding this feature ultimately led to me digging into most of the source code. Can you say link_to(‘home’) in python? I can :)

I even added the ability to ad layouts similar to rails. Actually, I did this as my first little project. But then I found out you could base-class Django-templates. DOH! Oh well.

Now what? I’m not sure yet. Let me know if you’re interested in the routes source and I’ll post it for the 4 spammers who read this blog. Earlier today, I discovered this open source project for porting the major pieces of GAE to the Amazon Cloud. Hilarious! Check it out here.

This is starting to become really interesting. Cloud computing is one area I believe Yahoo! entirely missed the boat on. The rumor-mill also says Microsoft could also be getting into this game, too. I say the more the merrier. All this competition will keep costs down and give me more things to play with.