(brian.com is an entry in my /etc/hosts pointing to 127.0.0.1 as a
workaround for localhost with Facebook OAuth2)

On Sat, Jun 23, 2012 at 12:29 AM, Alec Taylor <alec.tayl...@gmail.com> wrote:
> I modified the route.py as you suggested:
>
> routers = dict(
>    BASE=dict(
>        default_application='social',
>        functions = ['index', 'profile', 'user'],
>    )
> )
>
> Yet the URL continues to present at: http://brian.com/default/profile#_=_
>
> On Sat, Jun 23, 2012 at 12:15 AM, Jonathan Lundell <jlund...@pobox.com> wrote:
>> On Jun 22, 2012, at 7:06 AM, Alec Taylor wrote:
>>> Just tried that, it's still prepending the URL with "default".
>>>
>>> E.g.: http://localhost/default/profile rather than http://localhost/profile
>>
>> If you want the router to omit the default controller when you specify a 
>> non-default function, then you need to list your functions.
>>
>> routers = dict(
>>   BASE = dict(
>>       default_application = 'social',
>>       functions = ['index', 'profile', ... ],
>>   ),
>> )
>>
>> The functions list must be a complete list of the callable functions in the 
>> default controller.
>>
>> Otherwise, the router could ambiguously interpret http://localhost/profile 
>> as /myapp/default/index/profile.
>>
>> You can extend this functionality by defining functions as a dict of lists, 
>> where the dict keys are controller names. That allows dropping of functions 
>> in non-default controllers. The hazard of doing this is that the function 
>> list(s) really, really must be complete.
>>
>>
>>>
>>> On Fri, Jun 22, 2012 at 10:57 PM, Jonathan Lundell <jlund...@pobox.com> 
>>> wrote:
>>>> On Jun 22, 2012, at 3:08 AM, Alec Taylor wrote:
>>>>>
>>>>> My web2py\routes.py:
>>>>>
>>>>> routers = dict( BASE=dict( default_application='social',
>>>>> default_controller='default', default_function='index' ) )
>>>>> myapps = ['social']
>>>>> routes_in = [
>>>>>  ('/admin/$anything', '/admin/$anything'),
>>>>> ]
>>>>> for app in myapps:
>>>>>    routes_in += [ ('/%s/static/$anything' % app,
>>>>> '/%s/static/$anything' % app), ('/%s/appadmin/$anything' % app,
>>>>> '/%s/appadmin/$anything' % app), ('/%s/$anything' % app,
>>>>> '/%s/default/$anything' % app) ]
>>>>> routes_out = [(b, a) for (a, b) in routes_in]
>>>>>
>>>>> It correctly defaults the landing page to the 'social' app, but it
>>>>> isn't removing 'default' from my URLs.
>>>>>
>>>>> (I got the above from
>>>>> https://groups.google.com/forum/#!topic/web2py/QU71v2-GFaM)
>>>>>
>>>>> How can I remove 'default' from my URLs?
>>>>>
>>>>> Thanks for all suggestions,
>>>>
>>>> Don't mix the two routers. In particular, don't define routers if you're 
>>>> going to define routes_in/out.
>>>>
>>>> All you need is:
>>>>
>>>> routers = dict(
>>>>    BASE = dict(
>>>>        default_application = 'social',
>>>>    ),
>>>> )
>>>>
>>>> --
>>
>>
>>
>> --
>>
>>
>>

-- 



Reply via email to