Mapping a URL to a certain controller/function while not showing the app name as part of the URL

41 views
Skip to first unread message

Erik

unread,
Nov 7, 2014, 8:09:48 PM11/7/14
to web...@googlegroups.com
I'm using the parameter based system for routing. I have the following in my routes.py:

routers = dict(
    BASE=dict(
        default_application='myapp',
    )
)

When I open http://127.0.0.1:8000/shop I see the same content as I would see in http://127.0.0.1:8000/myapp/shop which is great since I don't want the app name to show in the URL.

Now I'm trying to figure out how can I map something like http://127.0.0.1:8000/shop/shoes to http://127.0.0.1:8000/shop? http://127.0.0.1:8000/shop/shoes should be in the URL but behind the scenes it should actually be pointing to just http://127.0.0.1:8000/shop.

Seems it's possible to do it using the Pattern-based approach, but when I do that way then I can't seem to hide the app name in the URL.

Any ideas? Thanks in advance!



Anthony

unread,
Nov 7, 2014, 9:46:36 PM11/7/14
to web...@googlegroups.com
It's not quite clear what you want. Is "shoes" a controller, and if so, are you saying you don't want it to appear in the URL but instead want it to be the default controller? If so, just set default_controller='shoes'.

Anthony

Erik

unread,
Nov 12, 2014, 2:45:13 PM11/12/14
to web...@googlegroups.com
I basically want either http://localhost/shop or http://localhost/shop/shoes to route to index() in shop.py. Is that possible?

File shop.py:

def index:
   return dict()
Reply all
Reply to author
Forward
0 new messages