You need to have at least a basic routes.py in the root /web2py folder, but 
for application specific routing, you can also put a routes.py file in the 
application folder (i.e., in /web2py/applications/myapp/). If you are using 
the pattern-based rewrite system, you'll need to use routes_app in the root 
routes.py file (as described at the end of this section of the book 
<http://web2py.com/books/default/chapter/29/04/the-core#Pattern-based-system>) 
to route to the app. If you are using the parameter-based system, the root 
routes.py file just needs a basic "router" dict (it could be empty or 
include a simple "BASE" dict). The app-specific routes.py file would then 
include a router specified like this:

router = dict(
    myapp = dict(
        ...
    )
)

where "myapp" is the name of the application. The rewrite system will 
compose the "router" from the root routes.py file with the "router" from 
the application routes.py file.

Anthony

On Wednesday, June 28, 2017 at 6:39:47 PM UTC-4, Brendan Barnwell wrote:
>
> Looking at the routing discussion in the docs, it seems that any kind of 
> custom routing has to be defined at the global level of the entire web2py 
> install.  Is that correct?  This seems awkward if I want to write an app 
> that carries with it its own knowledge of how it wants to route its 
> internal URLs, so that it can be dropped into an existing web2py install 
> without requiring extra global config (as web2py apps usually can be).
>
> Given that the usual web2py URL scheme is 
> host/app/controller/function/extra , what I'm wondering is, is there a way 
> for an application to hook into ONLY the /controller/function/extra part?  
> What I would like is to be able to get in AFTER web2py decides which app is 
> being accessed, but BEFORE it decides which controller file to load.  This 
> way I could, for instance, do URL rewrite rules that change /myapp/somepage 
> to /myapp/somecontroller/somepage --- again, without requiring any changes 
> to code outside the application's own folder.  Is this possible?
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to