Note, when you create or change routes.py, you need to reload it before it 
will take effect (either restart the server or click the "Reload routes" 
button in the admin interface).

Anthony

On Wednesday, July 11, 2012 5:14:20 PM UTC-4, Anthony wrote:
>
> web2py does not use a file called "router.py". All rewrite code goes in 
> routes.py. You can use either the parameter-based system (
> router.example.py is an example) *or* the pattern-based system (
> routes.example.py is an example), but not both.
>
> Anthony
>
> On Wednesday, July 11, 2012 4:49:33 PM UTC-4, Janath wrote:
>>
>> Hi, 
>> I am trying to make the home page of the  
>> http://111.111.111.11:8000/welcome/default/index<http://130.179.130.86:8000/welcome/default/index>
>>   
>> which is the default page loaded when I type   
>> http://111.111.111.11:8000<http://130.179.130.86:8000/welcome/default/index>,
>>  
>> to  
>> *http://111.111.111.11:8000<http://130.179.130.86:8000/welcome/default/index>
>> :pythonPsse/defult/index.html*
>>
>> having read the above articles, I created routes.py and router.py in the 
>> base web2py folder.
>>
>> and made following changes to each file:
>>
>> routes.py
>>
>> default_application = 'PythonPSSE'    # 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
>>
>> router.py
>>
>> routers = dict(
>>     BASE = dict(
>>         default_application = 'PythonPSSE',
>>         default_controller = 'default',
>>         default_function = 'index',
>>     ),
>> )
>>
>> however, it has no effect on the web2py behaviour, pages are downloaded 
>> as they were.
>>
>> I am sorry about raising this issue again. 
>>
>> Thank yoy,
>>
>> Janath
>>
>>
>>
>>
>>
>>
>>
>>
>> On Friday, May 18, 2012 1:19:03 PM UTC-5, Alexander McLin wrote:
>>>
>>> Sorry I posted too early,
>>>
>>> My solution is:
>>>
>>> in routes.py in the base folder, where myapp is the actual name of the 
>>> application I'm developing.
>>>
>>> routes_app = ((r'/(?P<app>welcome|admin|myapp)\b.*', r'\g<app>'),)
>>>
>>> and in myapp's folder, I have another routes.py with the following,
>>>
>>> routes_in = ((r'/myapp/users/(?P<id>\d*)', 
>>> r'/myapp/users/index/\g<id>'),)
>>>
>>> routes_out = 
>>> ((r'/myapp/users/index/(?P<id>\d*)', r'/myapp/users/\g<id>'),')
>>>
>>> This is what worked for me. 
>>>
>>>
>>> Alex
>>>
>>>
>>> On Friday, May 18, 2012 2:11:28 PM UTC-4, Alexander McLin wrote:
>>>>
>>>> Sorry if I wasn't clear, I actually meant URLs of the following form, 
>>>> myapp/controller/args to be mapped to myapp/controller/index/args. The 
>>>> second point of confusion takes a different tack on web2py routing than 
>>>> the 
>>>> first point.
>>>>
>>>> I'll try to experiment with your solution though.
>>>>
>>>> For future notes, I actually got the pattern-matching solution working, 
>>>> I realized that what I was missing was that I had to include my 
>>>> application's name in the routes_app for the custom routes to be enabled.
>>>>
>>>> In any event, my solution is
>>>>
>>>> On Friday, May 18, 2012 9:17:30 AM UTC-4, Wikus van de Merwe wrote:
>>>>>
>>>>> OK, so you want /myapp/args to be mapped to 
>>>>> /myapp/default_controller/default_function/args. By default args would be 
>>>>> interpreted as a function name and will be mapped to 
>>>>> /myapp/default_controller/args. To change that you need to define a list 
>>>>> of 
>>>>> functions for the default controller. Then if args is not in that list it 
>>>>> would be mapped to /myapp/default_controller/default_function/args.
>>>>>
>>>>> routers = dict( 
>>>>>     myapp = dict(
>>>>>         default_controller = "default",
>>>>>         default_function = "index",
>>>>>         functions = ["fun1", "fun2", "fun3"]
>>>>>     )
>>>>> )
>>>>>
>>>>>

Reply via email to