On Jan 7, 2011, at 12:14 PM, VP wrote: > > It is something like this: > > example1.com /app1/default > example2.com /app2/default > example3.com /app3/default
In that case: routers = dict( app1 = dict(domain='example1.com'), app2 = dict(domain='example2.com'), app3 = dict(domain='example3.com'), ) > > > On Jan 7, 11:17 am, Jonathan Lundell <jlund...@pobox.com> wrote: >> On Jan 7, 2011, at 12:34 AM, VP wrote: >> >> >> >>> sorry that was copy&paste mistake. Here it is: >> >> Thanks. What's your routes.conf? >> >> >> >>> try: config=open('routes.conf','r').read() >>> except: config='' >> >>> def auto_in(apps): >>> routes=[ >>> ('/robots.txt','/welcome/static/robots.txt'), >>> ('/admin$anything','/admin$anything'), >>> ] >>> for a,b in [x.strip().split() for x in apps.split('\n') if >>> x.strip() and not x.strip().startswith('#')]: >>> if not b.startswith('/'): b='/'+b >>> if b.endswith('/'): b=b[:-1] >>> app = b.split('/')[1] >>> routes+=[ >>> ('.*:https?://(www\.)?%s:$method /' % a,'%s' % b), >>> ('.*:https?://(www\.)?%s:$method /$anything' % a,'%s/ >>> $anything' % b), >>> ('.*:https?://(.*\.)?%s:$method /static/$anything' % a,'%s/ >>> static/$anything' % app), >>> ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' % >>> a,'%s/appadmin/$anything' % app), >>> ] >>> return routes >> >>> def auto_out(apps): >>> routes=[] >>> for a,b in [x.strip().split() for x in apps.split('\n') if >>> x.strip() and not x.strip().startswith('#')]: >>> if not b.startswith('/'): b='/'+b >>> if b.endswith('/'): b=b[:-1] >>> app = b.split('/')[1] >>> routes+=[ >>> ('%s/static/$anything' % app,'/static/$anything'), >>> ('%s/appadmin/$anything' % app, '/appadmin/$anything'), >>> ('%s/$anything' % b, '/$anything'), >>> ] >>> return routes >> >>> routes_in=auto_in(config) >>> routes_out=auto_out(config) >> >>