bobo & GAE

A blueprint on how to setup a new GAE project and run a basic bobo application on top of it.

First download and install the Google App Engine SDK, here is a Tutorial to get you started.

Next create an new package bobo_project. Inside bobo_project add an __init__.py file with empty contents.

    # a package

Now create the app.yaml file. It defines the application id and a single
wildcard URL handler:

    application: your-application-id
    version: 1
    runtime: python
    api_version: 1

    handlers:
    - url: /.*
      script: main.py

The main.py file creates, configures and runs the bobo WSGI application:

    import bobo
    import google.appengine.webapp.util

    bobo_app_name='project'

    def main():
        application = bobo.Application(bobo_resources=bobo_app_name)
        google.appengine.webapp.util.run_wsgi_app(application)

    if __name__ == '__main__':
        main()

project.py is the basic bobo web application:

    import bobo

    @bobo.query('/')
    def hello(name='world'):
        return 'Hello %s' % name

Finally add bobo.py (part of the bobo package) and - if you intend to use JSON - the simplejson package to the project folder (GAE runs on Python2.5).

The project layout now looks like:

    bobo_project/
      __init__.py
      app.yaml
      bobo.py
      main.py
      project.py
      simplejson/

Test-drive your project locally with the dev_appserver:

    gae$ python dev_appserver.py bobo_project &
    gae$ firefox http://localhost:8080/

Create a new appspot project ‘your-application-id’ and upload bobo_project into it:

    gae$ python appcfg.py update bobo_project

Access your application online:

    gae$ firefox http://your-application-id.appspot.com/

2 Responses to “bobo & GAE”


  1. 1 Dirk Holtwick Jun 23rd, 2009 at 8:13 am

    On GAE you don’t need to install simplejson, it is already there. Just do:

    from django.utils import simplejson

    Also you could use Pyxer for installing other packages inside the Bobo project using the built in easy_install support. See:

    http://code.google.com/p/pyxer/wiki/ShortSummary#Setup_a_new_project

  2. 2 d2m Feb 5th, 2010 at 8:57 am

    Update: changed source to use google.appengine.webapp.util.run_wsgi_app.
    Read more on possible exploits through wsgiref.handlers.CGIHandler on
    http://dirtsimple.org/2010/02/don-use-cgihandler-on-google-app-engine.html

Leave a Reply





Categories