Seems like this would be a lot easier using the parameter-based rewrite 
system.

Anthony

On Sunday, January 19, 2014 4:01:46 PM UTC-5, Joe Barnhart wrote:
>
> I'm trying to do the simplest routes.py possible.  I just want to get rid 
> of the application name -- EVERYWHERE.  In addition, I'd like my main page 
> (index.html) to just appear without any "default" controller in the URL. 
>  The problem is, the auth login dialog always includes my application name 
> in the "next=" field of the login form.  Nothing I do seems to affect it.
>
> My routes.py is pretty simple...  It's the default example routes.py with 
> the following additions:
>
>
> default_application = 'my_app_name'     # ordinarily set in base routes.py
> default_controller = 'default'  # ordinarily set in app-specific routes.py
> default_function = 'index'      # ordinarily set in app-specific routes.py
>
>
> BASE = ''  # optonal prefix for incoming URLs
>
> routes_in = (
>     # do not reroute admin unless you want to disable it
>     (BASE + '/admin', '/admin/default/index'),
>     (BASE + '/admin/$anything', '/admin/$anything'),
>     # do not reroute appadmin unless you want to disable it
>     (BASE + '/$app/appadmin', '/$app/appadmin/index'),
>     (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
>     #(BASE + '/appadmin', '/%s/appadmin'%default_application),
>     # do not reroute static files
>     (BASE + '/$app/static/$anything', '/$app/static/$anything'),
>     # reroute favicon and robots, use exable for lack of better choice
>     ('/favicon.ico', '/examples/static/favicon.ico'),
>     ('/robots.txt', '/examples/static/robots.txt'),
>     # route default app
>     (BASE + '/index.html', 
> '/%s/%s/index.html'%(default_application,default_controller)),
>     (BASE + '/about.html', 
> '/%s/%s/about.html'%(default_application,default_controller)),
>     (BASE + '/$anything', '/%s/$anything'%default_application),
>     # do other stuff
>     ((r'.*http://otherdomain.com.* (?P<any>.*)', r'/app/ctr\g<any>')),
>     # remove the BASE prefix
>     (BASE + '/$anything', '/$anything'),
> )
>
>
> routes_out = (
>     # do not reroute admin unless you want to disable it
>     ('/admin/$anything', BASE + '/admin/$anything'),
>     # do not reroute appadmin unless you want to disable it
>     ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>     # do not reroute static files
>     ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>     # do other stuff
>     (r'.*http://otherdomain.com.* /app/ctr(?P<any>.*)', r'\g<any>'),
>     (r'/app(?P<any>.*)', r'\g<any>'),
>     # map default application
>     ('/%s/%s/index.html'%(default_application,default_controller), 
> '/index.html'),
>     ('/%s/%s/about.html'%(default_application,default_controller), 
> '/about.html'),
>     ('/%s/$anything'%default_application, '/$anything'),
>     # restore the BASE prefix
>     ('/$anything', BASE + '/$anything'),
> )
>
>
> This seems like a pretty simple application of routes.py, and I would 
> expect it to be a popular use for it.  I don't know anyone who wants their 
> root page to be festooned with the application name when it is constant 
> across every page in the site.
>
> Warm regards,
>
> Joe
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to