This is a great example, but it focuses on the user coming from two different domains. Let's say for example that we wanted our app called app1, which is running on localhost with many other applications to be distinguishable. How would we modify the regular expression to handle that case?
The following will match anything coming from localhost which is NOT what I want: (r'.*?:https?://127.0.0.1:\w* /$anything', r'app1') How could I modify this to handle a URL like 127.0.0.1:8000/app1? Never used python re before, so any help would be much appreciated! On Thursday, June 13, 2013 8:20:22 AM UTC-5, Loïc wrote: > > In your web2py root folder, you have a base routes.py > for example in the base routes.py you define your two applications app1 > and app2 : > > # -*- coding: utf-8 -*- > #app1 > routes_app = ( > (r'.*?:https?://www.app1.com:\w* /$anything', r'app1'), > (r'.*?:https?://app1.com:\w* /$anything', r'app1') > ) > #app2 > routes_app += ( > (r'.*?:https?://www.app2.net:\w* /$anything', r'app2'), > (r'.*?:https?://app2.net:\w* /$anything', r'app2') > ) > > > Then in your application folder (app1 & app2) you have an other routes.py > which will be used in place of base routes.py for this app. For example > In app1 folder : > > # -*- coding: utf-8 -*- > routes_in = ( > (r'/', r'/app1/default/index'), > (r'/images', r'/app1/images/images_list'), > (r'/contact', r'/app1/default/contact_form'), > ) > > routes_out = [(x, y) for (y, x) in routes_in] > > > > > Le jeudi 13 juin 2013 14:04:39 UTC+2, Júlia Rizza a écrit : >> >> I was reading about the specific routes of applications in the book >> <http://web2py.com/books/default/chapter/29/04#Pattern-based-system> >> section Application-Specific URL rewrite, but didn't understand well how it >> works. Could someone explain for me how routes_app create a routes.py >> specific in each app and, if possible, give me an example? >> > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

