5: Handler Map

< Previous Step Next Step >


There is a section of code that maps incoming requests to the handlers



As per GAE's default webapp WSGI framework, there's a mapping, at the end of uag.py, between our defined URL regex's and our request handlers. 

To enable this, we'll add an alias line to our import section:

from google.appengine.ext.webapp.util import run_wsgi_app

The end of every main web application module in GAE-land looks like this:

application = webapp.WSGIApplication(
[('/', SplashPage),
('/login/', LoginPage),
('/logout/', LogoutPage),
('/user/(.*)/', UserPage),
('/admin/', AdminPage),
('/group/(.*)/', GroupPage),
('/create_group/', CreateGroup),
('/join_group/(.*)/', JoinGroup),
('/leave_group/(.*)/', LeaveGroup),
('/text_form/(.*)/', TextSectionAddEdit),
('/create_text/', TextSectionAddEdit),
('/delete_text/(.*)/', TextSectionDelete)],
debug=True)

def main():
run_wsgi_app(application)

if __name__ == "__main__":
main()



Comments