0

我有一个应用程序,其中/index路径具有特殊含义。我不希望 path/成为/index. 现在,当我访问时/,cherrypy 在内部将我重定向到index视图(对象方法)。

如何将路径路由/到除 之外的某个视图index?例如,就我而言,我希望它与/status.

4

1 回答 1

1

您应该能够安装 /到与 相同的位置/status,在您的代码中您可能拥有的某处可能有这样的一行:

cherrypy.tree.mount(Status(), '/status', config)

将其更改为以下内容:

status = Status()
cherrypy.tree.mount(status, '/status', config)
cherrypy.tree.mount(status, '/', config)
于 2012-04-10T20:23:54.770 回答