문제

The webapp2.WSGIApplication class is initialized with three arguments:

  1. routes: list of tuples
  2. debug: enable / disable debug mode
  3. config: dictionary of config values

Why is the first argument a list of tuples and not a dictionary?

도움이 되었습니까?

해결책

My guess is that the order of the tuples is important, and a dictionary has no order.

app = webapp2.WSGIApplication([
  ('/this page', ThisPageHandler),
  ('.*', FrontPage),
  ],debug=False)

If that was your app above, it's important to catch the /this_page route before the catch all .* is caught. A list preserves order where a dictionary does not.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top