How do I set a default page in Pylons?

Posted by Evgeny on Stack Overflow See other posts from Stack Overflow or by Evgeny
Published on 2010-03-09T04:14:28Z Indexed on 2010/03/09 4:21 UTC
Read the original article Hit count: 339

Filed under:
|
|

I've created a new Pylons application and added a controller ("main.py") with a template ("index.mako"). Now the URL http://myserver/main/index works. How do I make this the default page, ie. the one returned when I browse to http://myserver/ ?

I've already added a default route in 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

I've also deleted the contents of the public directory (except for favicon.ico), following the answer to http://stackoverflow.com/questions/1279403/default-route-doesnt-work Now I just get error 404.

What else do I need to do to get such a basic thing to work?

© Stack Overflow or respective owner

Related posts about pylons

Related posts about routes