여러 매개 변수를 사용하여 URL을 처리 할 방법 다음
CITY_RE = r'(/(?:[a-zA-Z0-9]+/?)*)'
app = webapp2.WSGIApplication([(CITY_RE, CityHandler)], debug = True)
을 사용 나는 /<country>/<region>/<city>/<category>
같은 URL과 일치하는 비슷한 접근법을 가지고있다.
app = webapp2.WSGIApplication([('/([^/]+)/?([^/]*)/?([^/]*)', RegionSearch)], config=settings.w2config, debug=True)
선언 핸들러 클래스의 관련 매개 변수 :이 정규식을 사용 /usa/california/losangeles/restaurants
.
class RegionSearch(SearchBaseHandler):
"""Handles regional search requests."""
def get(
self,
region=None,
city=None,
category=None,
subcategory='For sale',
PAGESIZE=50, # items on page
limit=60, # number of days
year=2012,
month=1,
day=1,
next_page=None,
):
난 당신이 이런 식으로 할도 수 있다고 생각
webapp2.Route('/passwdresetcomplete/<city>/<category>/<name>', handler=RegionSearch, name='regionsearch')