I got inside gluon. The conversion is done within regex_uri

I have found that 

http://127.0.0.1:8002/gallery
becomes
127.0.0.1:http://127.0.0.1:get /gallery

just before the conversion

http://localhost:8002/gallery
becomes
127.0.0.1:http://localhost:get /gallery

So Massimo was almost right the problem was putiing the get and post in 
upper case

routes_in = [('127\.0\.0\.1:http://.*?:(get|post) /$anything','/welcome')]

works

The answer to my challenge to get URLs with localhost to route to the admin 
app and URLs with 127.0.0.1 to route to the  welcome app

routes_in = [('.*://localhost:(get|post) /$anything','/admin'),
                           ('.*://127\.0\.0\.1:(get|post) 
/$anything','/welcome')]

So presumably to map mydomain to myapp would be

routes_in = [('.*://mydomain:(get|post) 
/myapp/$anything','/myapp/$anything'),
                  ('.*://mydomain:(get|post) 
/$anything','/myapp/$anything')]

or if using routes_app

routes_app=[('.*://mydomain:(get|post) /$anything','myapp'),


Peter

On Wednesday, 29 August 2012 19:15:03 UTC+1, peter wrote:
>
> Thanks for the suggestion Massimo
> It did not match with
>
> localhost or 127.0.0.1
>
> eg localhost:8002/gallery
>
> Peter
>
> On Wednesday, 29 August 2012 18:19:26 UTC+1, Massimo Di Pierro wrote:
>>
>> Are you trying to match the remote address as localhost? The problem is that 
>> it depends on what you browser puts in there. You can try:
>>
>> routes_in = [('127\.0\.0\.1:http://.*?:(GET|POST) /$anything','/welcome')]
>>
>>
>>
>>
>> On Wednesday, 29 August 2012 12:08:56 UTC-5, peter wrote:
>>>
>>> I tried
>>>
>>> routes_in = ((r' .*://localhost:.*',r'/welcome'),)
>>>
>>> and 
>>> routes_in = ((r' .*localhost.*',r'/welcome'),)
>>>
>>>
>>> neither match localhost urls so I am at a loss. I would like to know how 
>>> to match localhost.
>>>
>>> In the short run I want to do
>>>
>>>  domains={
>>>      'ukjazz.net':'british_jazz',
>>>      'www.ukjazz.net':'british_jazz',
>>>      'lindseymalin.com':'gallery',
>>>      'www.lindseymalin.com':'gallery'
>>> }
>>>
>>> with pattern matching rewrites. This is because I want to have a pattern 
>>> matching routes.py for british_jazz
>>>
>>> I am sure other people would like to do the equivalent of domains with 
>>> patterns
>>>
>>> Thanks
>>> Peter
>>>
>>> On Wednesday, 29 August 2012 16:21:12 UTC+1, Jonathan Lundell wrote:
>>>>
>>>> A little below that is the general structure of the incoming pattern.
>>>>
>>>> '[remote address]:[protocol]://[host]:[method] [path]'
>>>>
>>>>
>>>> In the long run, what are you really trying to accomplish with your 
>>>> routes? 
>>>>
>>>>
>>>>
>>> On Wednesday, 29 August 2012 16:21:12 UTC+1, Jonathan Lundell wrote:
>>>>
>>>> On 29 Aug 2012, at 8:13 AM, peter <peterchu...@gmail.com> wrote:
>>>>
>>>> I am not sure what docs you are referring to Jonathan. The book gives 
>>>> an example:
>>>>
>>>> "The general syntax for routes is more complex than the simple examples 
>>>> we have seen so far. Here is a more general and representative example:
>>>>
>>>> 1.
>>>> 2.
>>>> 3.
>>>> 4.
>>>>
>>>> routes_in = (
>>>>  ('140\.191\.\d+\.\d+:https://www.web2py.com:POST /(?P<any>.*)\.php',
>>>>   '/test/default/index?vars=\g<any>'),
>>>> )
>>>>
>>>> "
>>>> that seems to imply the URL is a string. It would be useful if one 
>>>> could see the URL presented to routes_in.
>>>>
>>>>
>>>> A little below that is the general structure of the incoming pattern.
>>>>
>>>> '[remote address]:[protocol]://[host]:[method] [path]'
>>>>
>>>>
>>>> So I think you'd want something like: '.*://localhost:.* [path]
>>>>
>>>>
>>>> Let me ask the second part of my initial post slightly revised.
>>>>
>>>> I would like, within routes_In to be able to route according to domain 
>>>> name.
>>>>
>>>>  
>>>>
>>>> So what would routes_in look like to route
>>>>
>>>>  127.0.0.1:8002 to welcome, and
>>>>
>>>>  localhost:8002 to admin
>>>>
>>>> In the long run, what are you really trying to accomplish with your 
>>>> routes? 
>>>>
>>>>
>>>>

-- 



Reply via email to