Take the 2-minute tour ×

I'm just now digging into GAE and I see two ways to make a particular URL pull up the right page.

The first way is using handlers:

  - url: /.*
    script: helloworld.py

The other way is using the following:

application = webapp.WSGIApplication(
                                 [('/', MainPage),
                                  ('/sign', Guestbook)],

Which is better or which is right? I don't fully understand what the second example is doing exactly.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You need to use both. The section in app.yaml tells App Engine where to look for your WSGI application. application = webapp.WSGIApplication(...) sets up your WSGI application using the webapp framework.



  - url: /city.*
    script: cityhandler.py


application = webapp.WSGIApplication([('/city', ShowCityPage)],
share|improve this answer
Let's say I want domain.com/city to point to particular .py file. I'd have to setup the regex in app.yaml and then setup '/city', City in the WSGI application. Is that correct? –  Noah Clark Nov 23 '10 at 17:22
See the updated answer. –  Robert Kluin Nov 23 '10 at 17:38
Awesome, and perfect! Oh, and thank you too! That all makes sense. –  Noah Clark Nov 23 '10 at 17:45
add comment

Your Answer


