Hi Tuan, I tried the change (line in red) but it couldn't route to my app properly. I'm not familiar with the regex routes, so I'm using it as-is. I don't know how to troubleshoot this.
On Friday, July 4, 2014 9:59:37 AM UTC+8, Nguyen Minh Tuan wrote: > > Hi Massimo, > > Lyn2py posted above is that issue I met, I post complete script : > (I mark the only one line I changed with red color) > > -------------- routes.py --------------------------- > config = ''' > site1.com.vn /hhp/default > site2.com.vn /welcome/default > ''' > > def auto_in(apps): > routes = [ > ('/admin$anything', '/admin$anything'), > ] > for domain, path in [x.strip().split() for x in apps.split('\n') if > x.strip() and not x.strip().startswith('#')]: > if not path.startswith('/'): > path = '/' + path > if path.endswith('/'): > path = path[:-1] > app = path.split('/')[1] > routes += [ > ('.*:https?://(.*\.)?%s:$method /' % domain, '%s' % path), > ('.*:https?://(.*\.)?%s:$method /static/$anything' % domain, > '/%s/static/$anything' % app), > ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' % domain, > '/%s/appadmin/$anything' % app), > ('.*:https?://(.*\.)?%s:$method /%s/$anything' % (domain, > app), '/%s/$anything' % app) > ] > return routes > > > def auto_out(apps): > routes = [] > for domain, path in [x.strip().split() for x in apps.split('\n') if > x.strip() and not x.strip().startswith('#')]: > if not path.startswith('/'): > path = '/' + path > if path.endswith('/'): > path = path[:-1] > app = path.split('/')[1] > routes += [ > ('/%s/static/$anything' % app, '/static/$anything'), > ('/%s/appadmin/$anything' % app, '/appadmin/$anything'), > ('/%s/$anything' % path, '/$anything') > ] > return routes > > routes_in = auto_in(config) > routes_out = auto_out(config) > --------------------------------------------------- > > Regards, > Tuan. > > > On 3 July 2014 21:51, Massimo Di Pierro <massimo....@gmail.com > <javascript:>> wrote: > >> There is nothing "default" specific in the script. Something else must be >> the problem. >> >> >> On Thursday, 3 July 2014 07:04:44 UTC-5, lyn2py wrote: >>> >>> I have a question for anyone using this… I realized that it only works >>> for redirects to the functions within default.py. If I setup another >>> controller, it can't route to that controller. Is this the intended >>> behaviour? How can I include other controllers without having to add one >>> controller for every line? Thanks :) >>> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/8KxcHTRIBWU/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.