On Mar 22, 2011, at 3:53 PM, David Warnock wrote:
> Is there any support for subdomains in either routing system? I couldn't see
> any.
>
> I am thinking of what I think 37signals use
>
> http://clienta.myapp.com/users // list of all users for client A
> http://clientb.myapp.com/users/dave // form for user dave within client B
> http://myapp.com/users/ // application administrators
>
> I am interested both for aesthetics and also because GAE supports namespaces
> via subdomains for controlling access to the data.
>
In the new router, you can configure domain routing in the BASE router. This is
an example from the unit test:
BASE = dict(
domains = {
"domain1.com" : "app1",
"www.domain1.com" : "app1",
"domain2.com" : "app2",
},
),
The domain can include a port, and the target can be a controller:
domains = {
# two domains to the same app
"domain1.com" : "app1",
"www.domain1.com" : "app1",
# same domain, two ports, to two apps
"domain2.com" : "app2a",
"domain2.com:8080" : "app2b",
# two domains, same app, two controllers
"domain3a.com" : "app3/c3a",
"domain3b.com" : "app3/c3b",
# http vs https
"domain6.com:80" : "app6",
"domain6.com:443" : "app6s",
},
But if you want to map the subdomain to (say) an arg, you'll have to use the
regex router.