【问题标题】:Redirect Route strict slash重定向路由严格斜杠
【发布时间】:2013-02-17 06:44:39
【问题描述】:

我正在尝试对 webapp2 重定向路由使用严格的斜线,但我收到了这个值错误 -

ValueError: Routes with strict_slash must have a name.

这是我的其中一条路线的示例 -

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

如果我没有 strict_slash 位,它可以正常工作。

【问题讨论】:

    标签: python google-app-engine webapp2


    【解决方案1】:

    我不知道为什么带有 strict_slash 的路由需要有一个名称,但以下应该可以工作:

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

    【讨论】:

      猜你喜欢
      • 2014-11-03
      • 2013-12-16
      • 2011-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-27
      • 2016-10-29
      • 1970-01-01
      相关资源
      最近更新 更多