On 29 Aug 2012, at 10:08 AM, peter <[email protected]> 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.
If there's actually a space at the beginning of the first pattern, it won't
match.
A good place to see a lot of routing examples is in the unit-test files.
gluon/tests/test_routes.py IIRC.
>
> 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 <[email protected]> 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?
>
>
>
> --
>
>
>
--