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 webapp2 - a lightweight framework that allows you quickly build simple web applications for the Python 2.7 runtime.
webapp2 is compatible with the WSGI standard for Python web applications. You don't have to use webapp2 to write Python applications for App Engine. Other web application frameworks, such as Django, work with App Engine, and App Engine supports any Python code that uses the CGI standard. The webapp2 project, by Rodrigo Moraes, started as a fork of the App Engine webapp framework, which was used by the Python 2.5 runtime. webapp2 includes a number of features that make developing web applications easier, such as improved support for URI routing, session management and localization. The Python 2.7 runtime uses webapp2, and the project is maintained externally to App Engine. It is supported, but not maintained, by Google.
For more information about webapp2, see the official documentation.
Using the webapp2 framework in Python 2.7
Python 2.7 applications can use either WSGI or CGI to handle requests, but WSGI is generally recommended (see Using WSGI).
Here is a simple webapp2 application that uses a WSGI interface:
import webapp2 class MainPage(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, webapp World!') app = webapp2.WSGIApplication([('/', MainPage)], debug=True)
Blobstore, Mail and XMPP Handlers
Since it is an external library, webapp2 does not provide any App Engine-specific services. Python 2.7 apps must use the webapp versions of
BlobstoreDownloadHandler. See webapp Blobstore Handlers for details.