重定向路由严格的斜杠 [英] Redirect Route strict slash

查看:124
本文介绍了重定向路由严格的斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

带有strict_slash的路由必须有一个名称。

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)

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

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

推荐答案

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

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')

这篇关于重定向路由严格的斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆