On 2 Aug 2012, at 12:34 PM, Bruno Rocha <[email protected]> wrote:
> routes.py
> ################################################
> routers = dict(
>     BASE = dict(
>         default_application = 'myapp',
>         default_controller = 'mycontroller',
>         default_function = 'function1',
>         controllers = ['default', 'mycontroller', 'etc'],
>         functions = ['function1', 'function2', 'function3'],
>         applications = ["myapp", "admin"]
>        )
> )
> 
> ###############################################
> 
> The hardest part is that you have to list each controller, app, function

Not really. By default, the router will pick up all the apps and controllers; 
you just need to list functions if you want to be able to do certain more 
aggressive shortening.

BTW, put app-specific parameters in the app's router dict, not in BASE.

routers = dict(
    BASE = dict(
        default_application = 'myapp',
       ),
    myapp = dict(
        default_controller = 'mycontroller',
        default_function = 'function1',
        functions = ['function1', 'function2', 'function3'],
    ),
)


>    
>        
> 
> On Thu, Aug 2, 2012 at 4:13 PM, Daniel Gonzalez <[email protected]> wrote:
> Hi,
> 
> I am running web2py with mod_wsgi behind apache. I have a single web2py 
> application.
> I would like to do the following URL mapping:
> 
> http://www.example.com/function1 -> myapp/mycontroller/function1
> 
> Where myapp is my application, which is only one.
> I do not have lots of functions, so maybe I can create a single controller 
> file, mycontroller.py
> And then I will define all functions that I need in that controller: 
> function1, function2, ...
> 
> How would I go about implementing this? Is this something that is better done 
> at the apache level, or at the web2py level?
> What are the thoughts / strategies used by people more familiar with web2py?
> 
> Thanks and regards,
> 


-- 



Reply via email to