English | Site Directory

Overview

App Engine supports any Python application with a CGI interface. A web application framework can simplify development by taking care of the details of the interface, letting you focus development effort on your applications features. App Engine includes a simple web application framework called webapp.

webapp is a WSGI-compatible framework. You can use webapp or any other WSGI framework with App Engine using a CGI adaptor, such as one provided by the Python standard library.

Here is a simple webapp application that uses a CGI adaptor with App Engine:

import wsgiref.handlers
from google.appengine.ext import webapp

class MainPage(webapp.RequestHandler):
  def get(self):
    self.response.headers['Content-Type'] = 'text/plain'
    self.response.out.write('Hello, webapp World!')

def main():
  application = webapp.WSGIApplication([('/', MainPage)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
  main()