Running the PyAMF shell with Django 1.0 and app-engine-patch

I lost quite a bit of time trying to get the PyAMF shell up and running on the <head> web site this week.

I started out by downloading the source for the shell app via a link on a post on the PyAMF blog. Unfortunately, the link was to the wrong version of the shell app (I've since informed the PyAMF team and Nick's fixed the link.)

Seeing that the example used sessions, I decided to port the site from Google App Engine Helper to app-engine-patch, which has support for sessions in Google App Engine. Porting to app-engine-patch meant that I had to port the site to Django 1.0 also. I've chronicled my experience with this previously.

Today, I pinged the PyAMF folks on IRC and realized that there was a Google App Engine-specific version available. Unfortunately, that didn't work out of the box either due to a clash between its sessions implementation and the sessions implementation in app-engine-patch. That, however, was simple enough to fix.

If you're running app-enginge-patch and want to run the PyAMF shell, refactor the gateway.py module to rename the Sessions class to ShellSessions and Bob's your uncle. (It might be an idea for the PyAMF team to modify the example so that it works out of the box with app-engine-shell.)

Also, make sure that you protect the shell by only allowing admin access to it.

I can't begin to express how empowering it is to have shell access to your app on Google App Engine and I have no idea how I got by without it for so long. A big thank-you to the PyAMF team for making the shell app and releasing it. Great job, guys!

I would love to see a standalone Django app of the shell that you can simply plug in to your existing apps. Unfortunately, this is currently not possible since the app has static files and you need to add static folders manually to your application's app.yaml file. I've filed an ECR on this -- star it if you'd like that feature.

Update: Scratch that, I keep running into the 1MB limit for datastructures while trying to run queries, etc., through the shell, making it practically useless.

Comments