Tag Archive for 'django'

GigBlastr - an experimental Pylons app on Google App Engine

On wednesday we had a big turnout at the monthly Boston Python Users Group meeting which was hosted for the first time at Betahouse, the co-working loft where Jazkarta has our office space. The topic for the evening was developing Python web apps for deploying to Google App Engine.Picture 2.png

The agenda for the evening…

1. Brian DeLacey gave a short intro to GAE supported by showing the video screencast of a Google engineer creating a simple guestbook application.

2. PK Shiu gave an intro to developing web applications with Django.

3. And then I gave a talk about building a simple Pylons app for Google App Engine. I had been working feverishly in the days preceding the meeting trying to get the app working, battling the unfamiliar syntax of a new web framework and bumping up against the limitations of GAE.

But before I dive into the technical details, a brief background on my motivation for building this app. At the last DevHouseBoston3 (also hosted at Betahouse), I paired up with Malthe Borch, (who was in town visiting from Copenhagen), to work on an idea called GigBlastr. The basic idea is to provide a tool for musicians who want to promote their gig on the plethora of event listing services (eventful, upcoming, facebook, twitter, etc) but don’t want to visit all of those sites individually.

So the GigBlastr service would provide a one-stop-shop service to “blast” the gig info to all those services just by filling out one form. This is similar to the service provided by Tubemogul for videos, and Ping.fm for status updates.

Malthe and I implemented some very basic functionality leveraging the content rules engine in Plone to take an event you post to your Plone site, and send that event information to Twitter and Eventful. Later, Lennart Regebro created a p4a.upcoming package to add support for posting the event info to Upcoming.org as well.

Well, this was all fine and dandy but who really wants to load up a big ol’ CMS just to post some events? So this idea simmered for about a year, and in the meantime Google App Engine was announced, and I began to think how cool it would be to deploy this app on GAE.

And thus began my hunt for an appropriate framework with which to at least build a proof-of-concept prototype. I discovered that one of GAE’s limitations is that they disallow the use of Python’s standard httplib and force you to use their own urlfetch. Well, this would mean re-writing all of the Python libraries for talking to the various APIs, since they all depend on httplib/urllib.

In response to the 372 people (at last count) who starred this issue as being really important to fix, Guido van Rossum (the inventor of Python and employee of Google) responded by saying that if someone wanted to write a urllib replacement on top of urlfetch, he would be happy to review it and try to get it added.

Well, not more than a week later, Ian Bicking (creator of Paste and SQLObject and developer at The Open Planning Project) came up with just that, an implementation of httplib on top of urlfetch.

It seemed as though the quickest way to try out the posting of event data using Ian’s patched httplib, was to follow his instructions for getting Pylons working on Google App Engine, since he had already got Pylons to work with his patched httplib.

Well, this proved to be more tricky than I had imagined, and I ran into one problem after another. At times I felt like a man walking in the desert and whenever I would see an oasis of water, it would be just a mirage. But thankfully, I was able to tap into Ian’s brain on the #pylons IRC channel and also talk to other Pylons folks, and eventually (just an hour before my presentation!), I was able to get it to work.

I can say that right now, this is bleeding edge stuff, and I wouldn’t recommend it unless you have a lot of patience, or unless Google decides to add Ian’s httplib and lift the 1000 file limit. This arbitrary 1000 file limit is one of the major obstacles in trying to get other Python-based web frameworks such as Zope 3 working on GAE, and has required many silly workarounds. Ian also comments on some of these limitations imposed by Google App Engine on his blog.

If you do want to check it out, I’ve posted the slides from my presentation (with cmd line examples) on slideshare.net.

Dave Fisher also recorded some video at the event but this clip is only about 5 min long.

For those of you who missed the Google I/O conference, you can watch the videos and view the slides from the presentations here.