我创建了一个新的Pylons应用程序并添加了一个带有模板(“index.mako”)的控制器(“main.py”)。现在URL http://myserver/main/index
工作。我如何使这个默认页面,即。当我浏览到http://myserver/
时返回的那个?如何在Pylons中设置默认页面?
我已经加入routing.py缺省路由
def make_map():
"""Create, configure and return the routes Mapper"""
map = Mapper(directory=config['pylons.paths']['controllers'],
always_scan=config['debug'])
map.minimization = False
# The ErrorController route (handles 404/500 error pages); it should
# likely stay at the top, ensuring it can always be resolved
map.connect('/error/{action}', controller='error')
map.connect('/error/{action}/{id}', controller='error')
# CUSTOM ROUTES HERE
map.connect('', controller='main', action='index')
map.connect('/{controller}/{action}')
map.connect('/{controller}/{action}/{id}')
return map
我也删除了public
目录中的内容(除favicon.ico的),答案Default route doesn't work下现在我只是得到错误404.
我还需要做什么才能获得这样一个基本的东西工作?
主塔使用路线,这些文档在开始使用路线时非常有用:http://routes.groovie.org/setting_up.html – 2010-03-09 04:39:03
这很有用 - 谢谢!我可以发誓我在从我复制的文件中看到'',而不是'/'。 – EMP 2010-03-09 05:40:20