Note: This framework is available to Python 2.5 users only. Python 2.7 users should use the webapp2 framework, which is highly compatible with webapp, and should not introduce server backward-compatibility issues. For more information, see Migrating to Python 2.7 .
A web application framework can simplify development by taking care of the details of the interface, letting you focus development effort on your application's features. The App Engine Python 2.5 environment includes a simple web application framework called webapp, which handles requests and allows you to easily build a response.
Using the webapp framework in Python 2.5
App Engine supports Python 2.5 applications with a CGI interface. The Python 2.5 runtime
doesn't
support a WSGI interface, however it is possible to use WSGI frameworks with the
run_wsgi_app
CGI adapter provided by the
webapp.util
package.
Here is a simple webapp application that uses a CGI adapter with App Engine:
from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class MainPage(webapp.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, webapp World!') application = webapp.WSGIApplication([('/', MainPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main()