Redirect Route strict slash

早过忘川 提交于 2019-12-07 16:45:56

问题


I'm trying to use strict slash with webapp2 redirect route and I'm getting this value error -

ValueError: Routes with strict_slash must have a name.

This is an example of one of my routes -

RedirectRoute(r'/',handler=IndexHandler,strict_slash=True)

It works fine if I don't have the strict_slash bit.


回答1:


I don't know why routes with a strict_slash need to have a name, but the following should work:

RedirectRoute(r'/',handler=IndexHandler,strict_slash=True,name='some_name')


来源:https://stackoverflow.com/questions/15180210/redirect-route-strict-slash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!