On 3 Oct 2012, at 8:38 AM, lyn2py <lyn...@gmail.com> wrote:
> With similar code in the main routes.py (main = in the web2py dir), the URL 
> helper will "leave out" the 'default' and 'index' from the web address. 
> E.g. assuming I have 'some_func' function in default.py controller, 
> URL generated = http://weburl.com/myapp/some_func
> Likewise, for index page, it will be = http://weburl.com/myapp
> 
> However, when I move the code to app-specific routes.py (which is routes.py 
> in the web2py/application/myapp folder), 
> the url becomes = http://weburl.com/myapp/default/some_func
> in this case, for index, it shows up as = 
> http://weburl.com/myapp/default/index
> 
> Hence what I meant by not working.

I see. I'll look into it, but I'm not able to right now.

For now, put the app : dict section in the main routes.py.

> 
> For complete reference, this is the code I use in main routes.py:
> routers = dict( 
>     BASE = dict( 
>         default_controller = 'default', 
>         default_function = 'index'
>     ),
> )
> 
> And the code in the app-specific routes.py is
>> routers = {
>>     app: dict(
>>         default_language = possible_languages['default'][0],
>>         languages = [lang for lang in possible_languages
>>                            if lang != 'default'],
>>         default_controller = 'default', #I added this
>>         default_function = 'index',     #and this
>>     )
>> }
> 
> 
> 
> On Wednesday, October 3, 2012 11:22:50 PM UTC+8, Jonathan Lundell wrote:
> On 2 Oct 2012, at 9:24 PM, lyn2py <lyn...@gmail.com> wrote:
>> The new (or maybe not so new, by now) app-specific routers is an excellent 
>> idea. I love it. 
>> 
>> Can I get some help regarding the use of it?
>> 
>> The following code is in my routes.py file, but it doesn't seem to work:
>> routers = {
>>     app: dict(
>>         default_language = possible_languages['default'][0],
>>         languages = [lang for lang in possible_languages
>>                            if lang != 'default'],
>>         default_controller = 'default', #I added this
>>         default_function = 'index',     #and this
>>     )
>> }
>> I added the two lines but it isn't working. (per the comments)
>> I have tried both reloading routes and restarting the server.
>> Is the syntax incorrect? Thanks!
> 
> What do you mean by "isn't working"?
> 
> 
> -- 
>  
>  
>  


-- 



Reply via email to