【发布时间】:2010-01-29 06:58:03
【问题描述】:
如何编写映射到显式 .htm 文件的路由?
例如我在 Pylons 的 /templates 下有一个 something.htm,我想将 http://myserver.com/something.htm 映射到 /templates 下的 something.htm。我可以使用 Routes for Pylons 来做到这一点,还是所有内容都映射到 /controller/action/id 的某种组合?
我认为一种方法是: map.connect('something.htm', '/something.htm', controller='something', action='something') 并为其创建一个虚拟控制器(仅返回 render(/something.htm))?
对于这个简单的工作来说,这似乎很麻烦。
有什么想法吗?
【问题讨论】: