I've been experimenting with ways of handling multiple domains inside a single Pylons app (as opposed to an app for each domain). Routes has subdomain support built-in, but mapping domains to subdomains just leads to problems with generating URLs.
So I wrote a bit of alpha code today to implement two-way support for multiple domains. I'd appreciate input on the method, or on whether Routes should grow built-in domain support. The code is here: http://github.com/countergram/routes_hosts And works like this (this goes in routing.py, in the custom routes area): example_host = HostCondition('example.com') example_host.alias('localhost:5000') with map.submapper(**example_host.args) as submap: submap.connect("fubar", '/foo', controller='foo', action='index') Then to generate a url, there's a helper function: absolute_url("fubar") => "http://example.com/foo"
-- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
