Debugging with the Google App Engine SDK

A few months ago I downloaded the Google App Engine SDK to play with. Everyone seemed to be going nuts over the demo, and I thought it would be neat to build a Komodo project template for creating, testing and deploying these apps (along the lines of the Rails and Zend MVC project templates).

I didn’t get very far (I’m not much of a Python programmer), but a Komodo user recently sent us the steps he used to get Google App Engine debugging working with Komodo IDE and the SDK. Here’s my permutation of those instructions for debugging the SDK’s demo guestbook application:

  1. If you don’t have one installed, get yourself a Python 2.5 interpreter (e.g. ActivePython 2.5.2)
  2. Download and install the Google App Engine SDK.
  3. Open ‘…/google_appengine/demos/guestbook/guestbook.py’ in Komodo
    and set some breakpoints.
  4. Click Debug|Go/Continue. The Debugging Options dialog should appear.
  5. Since you’ll probably want to reuse this configuration, click New next to the Debug Configuration drop list and give the new configuration a name like ‘Google App Engine’.
  6. Fill in the following fields in the General tab:
    • Script: the full path to google_appengine/dev_appserver.py
    • Script Arguments: the directory name of the app you want to debug. In this case ‘guestbook’.
    • Directory: the full path to the directory containing the application directory above (e.g. ‘/your/path/to/google_appengine/demos’)
  7. Click OK. This saves the configuration and starts
    the debugging session.

Komodo IDE will launch dev_appserver.py which in turn runs the guestbook app (on http://localhost:8080 by default). As you load the
page or interact with the application, Komodo should stop at the first breakpoint it hits.

You might find it useful to set up a Komodo project for your GAE app, that way you can save the debugging options mentioned above in the project’s Properties.

While you’re in the project properties, you should also add the SDK’s base directory (‘google_appengine’) under Languages|Python|Additional Python Import Directories. This will give you Python autocompletion in the google.appengine namespace.

Title photo courtesy of Christian Wiediger on Unsplash.

troyt