Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (56 sloc) 1.88 KB
layout title
Webpy + Google App Engine

Webpy + Google App Engine

This cookbook entry explains how to run as a google app engine application


  • Google App Engine Python API



  • The mechanisms for running GAE in python2.7 and 2.5 are different, change the app.yaml accordingly
  • is the main file of your application (2.5)
  • is the main file that includes the global variable app (2.7)
  • appname is the name that you specified while creating your GAE application
  • runtime for 2.5 is python, 2.7 is python27
  • threadsafe is only required in 2.7, read about it on the google app engine site

app.yaml for python 2.5

application: appname
version: 1
runtime: python
api_version: 1

- url: /.*

app.yaml for python 2.7

application: appname
version: 1
runtime: python27
api_version: 1
threadsafe: true

- url: /.*

To serve static files, you must add this under handlers (where static is the name of your static dir): - url: /static static_dir: static

Hello World!

This is a sample application that can be run by using (it is bundled with the SDK download):

import web

urls = (
    "/.*", "hello",

app = web.application(urls, globals())

class hello:
    def GET(self):
        return 'Hello, world!'

app = app.gaerun()

Save this as (or whatever you specified in app.yaml) and type: .

Now visit localhost:8080 in your browser and you should see hello world!


There is a blank page or an internal server error

solution: Make sure that you are running the version of python specified in the app.yaml file is not found

solution: Make sure that it is in your path

Jump to Line
Something went wrong with that request. Please try again.