Make URL point to .py file in App Engine
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:
handlers:
- url: /.*
script: helloworld.py
The other way is using the following:
application = webapp.WSGIApplication(
[('/', MainPage),
('/sign', Guestbook)],
debug=开发者_开发问答True)
Which is better or which is right? I don't fully understand what the second example is doing exactly.
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.
update:
app.yaml:
handlers:
- url: /city.*
script: cityhandler.py
cityhandler.py
application = webapp.WSGIApplication([('/city', ShowCityPage)],
debug=True)
精彩评论