Actually, I'm using the route.py script that Massimo provided a while
ago. But a more understandable configuration is preferable. Here it
is (routes.conf is not listed here):
default_function = 'v'
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
default_function = 'v'
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
On Jan 6, 2:45 pm, Jonathan Lundell <[email protected]> wrote:
> On Jan 6, 2011, at 11:52 AM, VP wrote:
>
>
>
> > While this is intended to simplify the current specifications of
> > routes.py (I think), what I have seen is more confusing to me. Does
> > this replace the old routes.py?
>
> > Maybe, can you provide examples of typical use cases? For example,
> > one VPS account, each domain mapping to each app. Anything else?
>
> BTW, I'd appreciate if you'd send me (or post here) your existing routes.py.
> I'll send back (or post) the equivalent routers configuration.
>
> I'd like to see some real-world configurations before declaring that the
> format and logic is final; it's entirely possible that I've missed some
> needed features.