Powered by App Engine
Posted July 13th, 2008
This entry will serve to introduce this blog and how it’s built. I’ll further elaborate on the process (and the problems I encountered) in subsequent posts.
I had been planning to rewrite my blog in Ruby on Rails for some time now. Joselyn’s site is powered by Rails, and I figured I’d use nearly the same code for my blog with updated templates and a couple of added features (e.g. Ajax-enabled comments and Last.fm statistics).
But then Google App Engine came out, and the game changed a bit.
App Engine includes a reasonable amount of hosting for free, and you can use Django layered on top to handle all of your web-appy things and make sure your project is kinda sorta portable. As an added bonus, I’m thinking about using App Engine for another project and figured this would be a good trial run.
Anyway, I decided to go with App Engine paired with Django. I hadn’t used either framework and had never used Python, but hey — that’s the fun part.
My goals were the following:
Improve maintainability
The previous incarnation of my blog was a tangled mess of PHP. I had no templating, limited improvised data objects and even hand-rolled Ajax and visual effects “libraries” that evolved out of random side projects. The code was also not under source control and I had no development environment or deployment mechanism.
The new blog is written using Django, so I get templating, URL parsing and all sorts of other goodies for free. I’m also using Prototype for Ajax (and lots of other nifty JS tools) and Scriptaculous for visual effects.
What’s more, it’s stored in my Subversion repository now, and I can use the mostly effective Google App Engine application configuration utility to deploy new versions.
Include more data from various web services
I have a lot of data out there, from Last.fm listening statistics to tweets to Flickr photos. Because of my shitty existing blog infrastructure, expanding it to include these would not be any fun.
The new version uses flickrpy to integrate my Flickr photostream and a combination of PyAWS and the fantastic Audioscrobbler web services to provide my weekly top albums. The top albums are conveniently provided in XML, and I then have to search Amazon.com using the Amazon Associates Web Service to snatch the proper album art.
Improve the archives
A couple of things here. First, my old URLs totally sucked: http://taylor-hughes.com/?entry=145 reveals nothing about the content included therein. What’s more, what if I don’t want a certain entry indexed by search engines? Do I have to list a bunch of entry ID numbers in robots.txt? No thonks.
Entries now have cleaner permalinks (like Joselyn’s), which let you know how (a) old the entry is and (b) a little something about it (usually). The archives pages are also a little nicer.
Improve various admin controls
Everybody hates building admin interfaces, and it really sucks when you’re working without a framework of any kind. My old blog had one admin page that served to add or edit a blog entry. Editing and deleting comments was done manually with database queries. Additionally, I had no capacity to turn off comments for an entry and no desire to add the functionality for aforementioned reasons.
Django’s automatic admin interface doesn’t quite work with App Engine, but I was able to use some of the built-in Django form generation stuff to ease the pain of creating and editing database entities.
That’s all for now.
Comments on “Powered by App Engine”
Alex on January 18th
I am also building a web page on google app engine and have some problems with threaded comments. I would realy appreciate it if you could give me some guide lines on how you did them on your blog.
In my models i have a reference to the page that you are commenting on and a self reference if you are answering a comment. Is this ok or do you have a better solution?
than on the rendering part i haven't found a solution that would be eficient. i don't want to query every comment for all responses, so this is my biggest problem for now.
Alex
Taylor on January 20th
Yeah, that's basically how I do it. Two ReferenceProperty columns, one for the entry and one for the parent comment.
Alternatively you could add the comments as children of the entry (and children of the parent comment) using entity groups, which is pretty well documented. Then fetching the comments all at once would be just WHERE ANCESTOR IS <blog entry object> or something like that. I believe there's a “is entity a child of this other entity?” method somewhere in the datastore API also.
Arnolds on November 27th, 2008
Respond to this comment
You should try this project: http://code.google.com/p/appengine-admin/
It lacks all the blings of Django Admin interface, but at least it does CRUD functions.