【发布时间】:2012-04-23 06:56:15
【问题描述】:
我无法让 trailing_slash 工具工作。我玩过 trailing_slash 工具的选项似乎没有任何效果。 我正在使用 CherryPy 3.2.2 和 Routes 1.13。我想拥有一个 添加了斜杠。调试输出中没有错误。
如果我去 127.0.0.1:8080/blog/ 它可以工作,但是如果我去 到 127.0.0.1:8080/blog 它没有。
我的配置是:
conf = {
'/': {
'request.dispatch': setup_routes(),
# This trailing slash stuff has no effect :(
'tools.trailing_slash.on': True,
'tools.trailing_slash.missing': True,
'tools.trailing_slash.status': 301,
},
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.root': os.path.dirname(os.path.abspath(__file__)),
'tools.staticdir.dir': 'static'
}
}
示例路线是:
routes = [["blog_index", "/blog/", {'controller': BlogController(), 'action': 'index','entry_id': 'index'}],]
谁能看到我做错了什么?是否有错误或缺乏 必要的文件? trailing_slash 工具是否可以与 Routes Dispatcher 一起使用?
【问题讨论】:
标签: python routing cherrypy trailing-slash