问题
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