以下のコードlocation_id = "Roger"
でcourt_id = "court1"
return webapp2.redirect("/schedule/%s/%s" % (location_id, court_id))
getの定義は次のとおりです。
class Schedule(BaseHandler):
def get(self, location_id, court_id):
self.render_template('schedule.html', {'location':location_id,'court':court_id})
しかし、次のルーティングを使用してschedule.htmlテンプレートに到達すると、
app = webapp2.WSGIApplication([
('/', MainPage),
('/create/([\w]+)', CreateCourt),
('/createlocation/([\w]+)', CreateLocation),
('/schedule/([\w]+/([\w]+))', Schedule)
],
debug=True)
の値は、との値location
を含むように成長しました: "Roger/court1"。/
court
「場所/裁判所」の2つの部分を分離するにはどうすればよいですか?答えは/scheduleのルーティング正規表現に関係していると思います。