Uncategorized

Solutions for Running Django in Cloud Computing Environments

I’ve lately been paying a lot of attention to the cloud computing offerings from Google and Amazon, but the more you learn about them the more it seems like you really have to program for them. My dilemma is that I’ve developed a mostly complete application that I’d like to explore migrating into one of these solutions.

I got initially quite excited when I found a tutorial on Google’s site, explaining how to run Django on the Google App Engine, but of course my dreams were shattered when I got to this part:

“Since App Engine does not support Django models … The authentication and admin middleware and apps should be disabled … Sessions also depend on Django models and must be disabled as well.”

Obviously this is a big problem, as disabling models, authentication, admin, and sessions, pretty much neuters Django to the point of uselessness.

This afternoon, however, I came across a blog by Thomas Brox Røst which explains how to adapt your Django models to support Google’s data framework internally, which should hopefully lead to transparency from the DAL up. My only worry is that this is so simple that its very omission in Google’s own how-to seems to imply there’s something wrong with it in practice.

Alternatively, Mr. Røst has also written up a nice tutorial on enabling persistent storage in an Amazon EC2 instance by placing a PostgreSQL database in an EBS virtual drive. The great thing about this is that it’s a real live database, so the only programming changes required might be in my stored reporting queries, which are written for a MySQL database instead of PostgreSQL. Compared to a dedicated hosting environment, it’s apparently even cost-competitive.

Either way, I love the idea of using Django as a platform-independent development framework that can not only be ported between operating systems, but into basically any environment that can run Python and support some sort of data store. When you look back at what Sun was going for ten years ago, Python and Django seem to have accomplished more without even trying.