Thanks, Anthony
Parameter-based routing does work for subdomains, but it doesn't seem to
accept wildcards like this:
domains = {
'localhost:8000' : 'welcome',
'*.localhost:8000': 'operations'
}
I almost have pattern-based routing working. I'm going to post another
question with a fuller explanation of what I'm trying to do.
On Wednesday, April 4, 2012 4:38:47 PM UTC-4, Anthony wrote:
>
> Have you tried the parameter-based rewrite system? It supports domain
> routing -- maybe it works for subdomains as well -- see
> http://web2py.com/books/default/chapter/29/4#Parameter-based-system. Not
> sure subdomains will work on localhost without some configuration, though.
>
> Anthony
>
> On Wednesday, April 4, 2012 1:53:56 PM UTC-4, Cliff wrote:
>>
>> In my application, "localhost:8000" should go to the welcome app.
>> Any request with a subdomain, such as "dc.localhost:8000" should go to
>> the operations app.
>>
>> I try this, but it raises syntax errors at startup:
>> routes_in = (
>> ("localhost:8000", '/welcome'),
>> ('.*\.localhost:8000', '/operations')
>> )
>> routes_out = (
>> ('/welcome', r"//localhost:8000"),
>> ('/operations', '.*\.localhost:8000')
>> )
>>
>> Traceback (most recent call last):
>> File "web2py.py", line 16, in <module>
>> import gluon.widget
>> File "/media/Myfiles/3-o/gluon/widget.py", line 23, in <module>
>> import main
>> File "/media/Myfiles/3-o/gluon/main.py", line 114, in <module>
>> rewrite.load()
>> File "/media/Myfiles/3-o/gluon/rewrite.py", line 274, in load
>> p[sym].append(compile_regex(k, v))
>> File "/media/Myfiles/3-o/gluon/rewrite.py", line 361, in compile_regex
>> raise SyntaxError, "routes pattern syntax error: path needs leading
>> '/' [%s]" % k0
>> SyntaxError: routes pattern syntax error: path needs leading '/'
>> [//localhost:8000]
>>
>> What am I doing wrong?
>>
>> Thanks,
>> Cliff Kachinske
>>
>