Re: [web2py] Re: routes for subdomain
On Feb 17, 2010, at 5:38 AM, Wikus van de Merwe wrote: To get what you want you could use this two rules for routes_in: ('.*:https?://domain\.com:get /([a-z]+)/(.*)', r'/init/public/\1/\2') ('.*:https?://([a-z]+)\.domain\.com:get /(.*)', r'/init/\1/\2') See the full doctest example: http://pastebin.com/fe773b3c However, I'm not sure if this is a complete solution as filter_in function in gluon/rewrite.py is rewriting paths only, not the host names. So you get http://ctr.domain.com/init/ctr/fun; instead of clean http://domain.com/init/ctr/fun;. True, but why would it matter? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
On Feb 16, 2010, at 10:38 PM, Thadeus Burgess wrote: example.com/controllerA/function1 - /init/controllerA/function1 example.com/controllerA/function2 - /init/controllerA/function2 example.com/controllerB/function1 - /init/controllerB/function1 example.com/controllerB/function2 - /init/controllerB/function2 example.com/$anything - /init/defaultController/$anything dashboard.example.com/function1 - /init/dashboard/function1 dashboard.example.com/function2 - /init/dashboard/function2 dashboard.example.com/$anything - /init/dashboard/$anything Any of the above URLS should work. You should NOT be able to do the following, dashboard controller should only be accessed by this single subdomain. !example.com/init/dashboard/function1 I don't care if I have to declare every controller in routes... I would have to do that in django/werkzeug/ruby/php/etc. I'm ready for web2py to get out of my way and let me do what I want to do. When I said rewrite hostname I ment to redirect a single hostname to a single web2py controller. This is the same concept as example1.com goes to app1 and example2.com goes to app2, but on the controller level instead of app level! (because the controllers share models) Hopefully this gets my point across. Would you repost the routes.py code that you think should accomplish the above? I think it should be doable. I think what you want in routes_in is: 1. handle any other apps explicitly (admin, for example) 2. if the subdomain is dashboard, prefix init/dashboard 3. if the controller is now dashboard, it's an error 4. everything else gets passed through Then in routes_out: 1. strip init/dashboard 2. strip init The only problem I see is routes_in step 3 above: you don't want to allow an access of the form example.com/dashboard/function, because it's ambiguous on output. If that's not a problem though -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
Thank you everyone! Finally. Wikus van de Merew your a genius. The following routes does it, and if you try to access example.com/dashboard you get a 404. The only change I needed to make was to wildcard the GET/POST at the end. routes_in = ( ('.*:/favicon.ico', '/init/static/favicon.ico'), ('.*:/robots.txt', '/init/static/robots.txt'), ('.*:https?://dashboard\.example\.com:.* /(.*)', r'/init/dashboard/\2'), ('^/admin(?Pany.*)', '/admin\gany'), ('^/appadmin(?Pany.*)', '/init/appadmin\gany'), ('^/(?Pany.*)', '/init/public/\gany'), ) routes_out = ( ('/init/dashboard/(?Pany.*)', '/\gany'), ) This makes me extremely happy (because it makes my boss happy) -Thadeus On Wed, Feb 17, 2010 at 10:33 AM, Jonathan Lundell jlund...@pobox.com wrote: On Feb 16, 2010, at 10:38 PM, Thadeus Burgess wrote: example.com/controllerA/function1 - /init/controllerA/function1 example.com/controllerA/function2 - /init/controllerA/function2 example.com/controllerB/function1 - /init/controllerB/function1 example.com/controllerB/function2 - /init/controllerB/function2 example.com/$anything - /init/defaultController/$anything dashboard.example.com/function1 - /init/dashboard/function1 dashboard.example.com/function2 - /init/dashboard/function2 dashboard.example.com/$anything - /init/dashboard/$anything Any of the above URLS should work. You should NOT be able to do the following, dashboard controller should only be accessed by this single subdomain. !example.com/init/dashboard/function1 I don't care if I have to declare every controller in routes... I would have to do that in django/werkzeug/ruby/php/etc. I'm ready for web2py to get out of my way and let me do what I want to do. When I said rewrite hostname I ment to redirect a single hostname to a single web2py controller. This is the same concept as example1.com goes to app1 and example2.com goes to app2, but on the controller level instead of app level! (because the controllers share models) Hopefully this gets my point across. Would you repost the routes.py code that you think should accomplish the above? I think it should be doable. I think what you want in routes_in is: 1. handle any other apps explicitly (admin, for example) 2. if the subdomain is dashboard, prefix init/dashboard 3. if the controller is now dashboard, it's an error 4. everything else gets passed through Then in routes_out: 1. strip init/dashboard 2. strip init The only problem I see is routes_in step 3 above: you don't want to allow an access of the form example.com/dashboard/function, because it's ambiguous on output. If that's not a problem though -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
On Feb 17, 2010, at 9:57 AM, Thadeus Burgess wrote: Thank you everyone! Finally. Wikus van de Merew your a genius. The following routes does it, and if you try to access example.com/dashboard you get a 404. This is a good solution in your case because it's easy to specify the other controller(s) explicitly. It occurred to me that an alternative solution, if there were many controllers, would be to send this case to a separate controller, which could then redirect to the appropriate dashboard.example.com URL. The only change I needed to make was to wildcard the GET/POST at the end. routes_in = ( ('.*:/favicon.ico', '/init/static/favicon.ico'), ('.*:/robots.txt', '/init/static/robots.txt'), ('.*:https?://dashboard\.example\.com:.* /(.*)', r'/init/dashboard/\2'), ('^/admin(?Pany.*)', '/admin\gany'), ('^/appadmin(?Pany.*)', '/init/appadmin\gany'), ('^/(?Pany.*)', '/init/public/\gany'), ) routes_out = ( ('/init/dashboard/(?Pany.*)', '/\gany'), ) This makes me extremely happy (because it makes my boss happy) -Thadeus On Wed, Feb 17, 2010 at 10:33 AM, Jonathan Lundell jlund...@pobox.com wrote: On Feb 16, 2010, at 10:38 PM, Thadeus Burgess wrote: example.com/controllerA/function1 - /init/controllerA/function1 example.com/controllerA/function2 - /init/controllerA/function2 example.com/controllerB/function1 - /init/controllerB/function1 example.com/controllerB/function2 - /init/controllerB/function2 example.com/$anything - /init/defaultController/$anything dashboard.example.com/function1 - /init/dashboard/function1 dashboard.example.com/function2 - /init/dashboard/function2 dashboard.example.com/$anything - /init/dashboard/$anything Any of the above URLS should work. You should NOT be able to do the following, dashboard controller should only be accessed by this single subdomain. !example.com/init/dashboard/function1 I don't care if I have to declare every controller in routes... I would have to do that in django/werkzeug/ruby/php/etc. I'm ready for web2py to get out of my way and let me do what I want to do. When I said rewrite hostname I ment to redirect a single hostname to a single web2py controller. This is the same concept as example1.com goes to app1 and example2.com goes to app2, but on the controller level instead of app level! (because the controllers share models) Hopefully this gets my point across. Would you repost the routes.py code that you think should accomplish the above? I think it should be doable. I think what you want in routes_in is: 1. handle any other apps explicitly (admin, for example) 2. if the subdomain is dashboard, prefix init/dashboard 3. if the controller is now dashboard, it's an error 4. everything else gets passed through Then in routes_out: 1. strip init/dashboard 2. strip init The only problem I see is routes_in step 3 above: you don't want to allow an access of the form example.com/dashboard/function, because it's ambiguous on output. If that's not a problem though -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
Can I do it for just one $c then, that is all I need. Every other controller will continue to function normally, this is only a special case controller. -Thadeus On Tue, Feb 16, 2010 at 4:35 PM, mdipierro mdipie...@cs.depaul.edu wrote: This cannot be done with routes (at least not unless you list all options for c). You can do this with mod-rewrite in apache. On Feb 16, 4:06 pm, Thadeus Burgess thade...@thadeusb.com wrote: No. example.com/$c/$f maps to /init/public/$c/$f and then dashboard.example.com/$f maps to /init/dashboard/$f I basically want $c.example.com/$f /init/$c/$f As I say this I kind of remember a post about this, search failing me. -Thadeus On Tue, Feb 16, 2010 at 4:02 PM, Wes James compte...@gmail.com wrote: forgot right bracket ] On Tue, Feb 16, 2010 at 2:59 PM, Wes James compte...@gmail.com wrote: On Tue, Feb 16, 2010 at 2:42 PM, Thadeus Burgess thade...@thadeusb.com wrote: I need to take the following with routes controller.website.com/action/args and convert it to /init/controller/action/args How can I do this, I have attempted to copy the book example however it is just giving syntax errors. This is a guess based on an example I saw: routes_in=[('/init/controller/action/args','/action/args') -wes -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
I can't find any apache rewrite rules that work in this manner. Basically i am just trying to get dashboard.example.com to internally rewrite web2py's URL scheme so that it looks at /init/dashboard but the user is still staring at dashboard.example.com in their browser. This means web2py routes_out will have to rewrite to the domain schema as well. it is not looking like I can accomplish this with routes or mod_rewrite. Massimo you have said you can redirect to two different apps depending on http_host, isn't this a similar situation? By the way. routes_in containing ('.*:https://dashboard.example.com:GET /(?any.*)', '/init/dashboard/\gany'), produces Traceback (most recent call last): [Tue Feb 16 16:14:58 2010] [error] [client File /home/servant/sites/themediapanel.com/public/web2py/wsgihandler.py, line 24, in module [Tue Feb 16 16:14:58 2010] [error] [client import gluon.main [Tue Feb 16 16:14:58 2010] [error] [client ] File gluon/main.py, line 105, in module [Tue Feb 16 16:14:58 2010] [error] [client ] rewrite.load() [Tue Feb 16 16:14:58 2010] [error] [client] File gluon/rewrite.py, line 65, in load [Tue Feb 16 16:14:58 2010] [error] [client params.routes_in.append((re.compile(k, re.DOTALL), v)) [Tue Feb 16 16:14:58 2010] [error] [client] File /usr/lib/python2.6/re.py, line 190, in compile [Tue Feb 16 16:14:58 2010] [error] [client ] return _compile(pattern, flags) [Tue Feb 16 16:14:58 2010] [error] [client ] File /usr/lib/python2.6/re.py, line 245, in _compile [Tue Feb 16 16:14:58 2010] [error] [client ] raise error, v # invalid expression [Tue Feb 16 16:14:58 2010] [error] [client] error: syntax error -Thadeus On Tue, Feb 16, 2010 at 5:06 PM, Thadeus Burgess thade...@thadeusb.com wrote: Can I do it for just one $c then, that is all I need. Every other controller will continue to function normally, this is only a special case controller. -Thadeus On Tue, Feb 16, 2010 at 4:35 PM, mdipierro mdipie...@cs.depaul.edu wrote: This cannot be done with routes (at least not unless you list all options for c). You can do this with mod-rewrite in apache. On Feb 16, 4:06 pm, Thadeus Burgess thade...@thadeusb.com wrote: No. example.com/$c/$f maps to /init/public/$c/$f and then dashboard.example.com/$f maps to /init/dashboard/$f I basically want $c.example.com/$f /init/$c/$f As I say this I kind of remember a post about this, search failing me. -Thadeus On Tue, Feb 16, 2010 at 4:02 PM, Wes James compte...@gmail.com wrote: forgot right bracket ] On Tue, Feb 16, 2010 at 2:59 PM, Wes James compte...@gmail.com wrote: On Tue, Feb 16, 2010 at 2:42 PM, Thadeus Burgess thade...@thadeusb.com wrote: I need to take the following with routes controller.website.com/action/args and convert it to /init/controller/action/args How can I do this, I have attempted to copy the book example however it is just giving syntax errors. This is a guess based on an example I saw: routes_in=[('/init/controller/action/args','/action/args') -wes -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
On Feb 16, 2010, at 3:37 PM, Thadeus Burgess wrote: By the way. routes_in containing ('.*:https://dashboard.example.com:GET /(?any.*)', '/init/dashboard/\gany'), (?Pany... -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
Thanks. It is not working like expected. It is now going to /init/default/index. ('.*:https://dashboard.example.com:.* /(?Pany.*)', '/init/dashboard/\gany'), -Thadeus On Tue, Feb 16, 2010 at 6:08 PM, Jonathan Lundell jlund...@pobox.com wrote: On Feb 16, 2010, at 3:37 PM, Thadeus Burgess wrote: By the way. routes_in containing ('.*:https://dashboard.example.com:GET /(?any.*)', '/init/dashboard/\gany'), (?Pany... -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
On Feb 16, 2010, at 4:25 PM, Thadeus Burgess wrote: Thanks. It is not working like expected. It is now going to /init/default/index. You might try experimenting with the doctest in routes.example.py (copy it and main to your routes.py unless it's already there). Going to the default location (/init/default/index) suggests that nothing is matching. ('.*:https://dashboard.example.com:.* /(?Pany.*)', '/init/dashboard/\gany'), -Thadeus On Tue, Feb 16, 2010 at 6:08 PM, Jonathan Lundell jlund...@pobox.com wrote: On Feb 16, 2010, at 3:37 PM, Thadeus Burgess wrote: By the way. routes_in containing ('.*:https://dashboard.example.com:GET /(?any.*)', '/init/dashboard/\gany'), (?Pany... -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
Ok I have spent way to long on this, I can't get any configuration of routes/mod_rewrite to rewrite the hostname. -Thadeus On Tue, Feb 16, 2010 at 10:51 PM, mdipierro mdipie...@cs.depaul.edu wrote: No you just need routes in to rewrite the hostname. Routesout just need to delete dashboard from path. On Feb 16, 5:37 pm, Thadeus Burgess thade...@thadeusb.com wrote: I can't find any apache rewrite rules that work in this manner. Basically i am just trying to get dashboard.example.com to internally rewrite web2py's URL scheme so that it looks at /init/dashboard but the user is still staring at dashboard.example.com in their browser. This means web2py routes_out will have to rewrite to the domain schema as well. it is not looking like I can accomplish this with routes or mod_rewrite. Massimo you have said you can redirect to two different apps depending on http_host, isn't this a similar situation? By the way. routes_in containing ('.*:https://dashboard.example.com:GET/(?any.*)', '/init/dashboard/\gany'), produces Traceback (most recent call last): [Tue Feb 16 16:14:58 2010] [error] [client File /home/servant/sites/themediapanel.com/public/web2py/wsgihandler.py, line 24, in module [Tue Feb 16 16:14:58 2010] [error] [client import gluon.main [Tue Feb 16 16:14:58 2010] [error] [client ] File gluon/main.py, line 105, in module [Tue Feb 16 16:14:58 2010] [error] [client ] rewrite.load() [Tue Feb 16 16:14:58 2010] [error] [client] File gluon/rewrite.py, line 65, in load [Tue Feb 16 16:14:58 2010] [error] [client params.routes_in.append((re.compile(k, re.DOTALL), v)) [Tue Feb 16 16:14:58 2010] [error] [client] File /usr/lib/python2.6/re.py, line 190, in compile [Tue Feb 16 16:14:58 2010] [error] [client ] return _compile(pattern, flags) [Tue Feb 16 16:14:58 2010] [error] [client ] File /usr/lib/python2.6/re.py, line 245, in _compile [Tue Feb 16 16:14:58 2010] [error] [client ] raise error, v # invalid expression [Tue Feb 16 16:14:58 2010] [error] [client] error: syntax error -Thadeus On Tue, Feb 16, 2010 at 5:06 PM, Thadeus Burgess thade...@thadeusb.com wrote: Can I do it for just one $c then, that is all I need. Every other controller will continue to function normally, this is only a special case controller. -Thadeus On Tue, Feb 16, 2010 at 4:35 PM, mdipierro mdipie...@cs.depaul.edu wrote: This cannot be done with routes (at least not unless you list all options for c). You can do this with mod-rewrite in apache. On Feb 16, 4:06 pm, Thadeus Burgess thade...@thadeusb.com wrote: No. example.com/$c/$f maps to /init/public/$c/$f and then dashboard.example.com/$f maps to /init/dashboard/$f I basically want $c.example.com/$f /init/$c/$f As I say this I kind of remember a post about this, search failing me. -Thadeus On Tue, Feb 16, 2010 at 4:02 PM, Wes James compte...@gmail.com wrote: forgot right bracket ] On Tue, Feb 16, 2010 at 2:59 PM, Wes James compte...@gmail.com wrote: On Tue, Feb 16, 2010 at 2:42 PM, Thadeus Burgess thade...@thadeusb.com wrote: I need to take the following with routes controller.website.com/action/args and convert it to /init/controller/action/args How can I do this, I have attempted to copy the book example however it is just giving syntax errors. This is a guess based on an example I saw: routes_in=[('/init/controller/action/args','/action/args') -wes -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
On Feb 16, 2010, at 9:31 PM, Thadeus Burgess wrote: Ok I have spent way to long on this, I can't get any configuration of routes/mod_rewrite to rewrite the hostname. I think Massimo is right: you don't have any reason to rewrite the hostname. -Thadeus On Tue, Feb 16, 2010 at 10:51 PM, mdipierro mdipie...@cs.depaul.edu wrote: No you just need routes in to rewrite the hostname. Routesout just need to delete dashboard from path. On Feb 16, 5:37 pm, Thadeus Burgess thade...@thadeusb.com wrote: I can't find any apache rewrite rules that work in this manner. Basically i am just trying to get dashboard.example.com to internally rewrite web2py's URL scheme so that it looks at /init/dashboard but the user is still staring at dashboard.example.com in their browser. This means web2py routes_out will have to rewrite to the domain schema as well. it is not looking like I can accomplish this with routes or mod_rewrite. Massimo you have said you can redirect to two different apps depending on http_host, isn't this a similar situation? By the way. routes_in containing ('.*:https://dashboard.example.com:GET/(?any.*)', '/init/dashboard/\gany'), produces Traceback (most recent call last): [Tue Feb 16 16:14:58 2010] [error] [client File /home/servant/sites/themediapanel.com/public/web2py/wsgihandler.py, line 24, in module [Tue Feb 16 16:14:58 2010] [error] [client import gluon.main [Tue Feb 16 16:14:58 2010] [error] [client ] File gluon/main.py, line 105, in module [Tue Feb 16 16:14:58 2010] [error] [client ] rewrite.load() [Tue Feb 16 16:14:58 2010] [error] [client] File gluon/rewrite.py, line 65, in load [Tue Feb 16 16:14:58 2010] [error] [client params.routes_in.append((re.compile(k, re.DOTALL), v)) [Tue Feb 16 16:14:58 2010] [error] [client] File /usr/lib/python2.6/re.py, line 190, in compile [Tue Feb 16 16:14:58 2010] [error] [client ] return _compile(pattern, flags) [Tue Feb 16 16:14:58 2010] [error] [client ] File /usr/lib/python2.6/re.py, line 245, in _compile [Tue Feb 16 16:14:58 2010] [error] [client ] raise error, v # invalid expression [Tue Feb 16 16:14:58 2010] [error] [client] error: syntax error -Thadeus On Tue, Feb 16, 2010 at 5:06 PM, Thadeus Burgess thade...@thadeusb.com wrote: Can I do it for just one $c then, that is all I need. Every other controller will continue to function normally, this is only a special case controller. -Thadeus On Tue, Feb 16, 2010 at 4:35 PM, mdipierro mdipie...@cs.depaul.edu wrote: This cannot be done with routes (at least not unless you list all options for c). You can do this with mod-rewrite in apache. On Feb 16, 4:06 pm, Thadeus Burgess thade...@thadeusb.com wrote: No. example.com/$c/$f maps to /init/public/$c/$f and then dashboard.example.com/$f maps to /init/dashboard/$f I basically want $c.example.com/$f /init/$c/$f As I say this I kind of remember a post about this, search failing me. -Thadeus On Tue, Feb 16, 2010 at 4:02 PM, Wes James compte...@gmail.com wrote: forgot right bracket ] On Tue, Feb 16, 2010 at 2:59 PM, Wes James compte...@gmail.com wrote: On Tue, Feb 16, 2010 at 2:42 PM, Thadeus Burgess thade...@thadeusb.com wrote: I need to take the following with routes controller.website.com/action/args and convert it to /init/controller/action/args How can I do this, I have attempted to copy the book example however it is just giving syntax errors. This is a guess based on an example I saw: routes_in=[('/init/controller/action/args','/action/args') -wes -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: routes for subdomain
example.com/controllerA/function1 - /init/controllerA/function1 example.com/controllerA/function2 - /init/controllerA/function2 example.com/controllerB/function1 - /init/controllerB/function1 example.com/controllerB/function2 - /init/controllerB/function2 example.com/$anything - /init/defaultController/$anything dashboard.example.com/function1 - /init/dashboard/function1 dashboard.example.com/function2 - /init/dashboard/function2 dashboard.example.com/$anything - /init/dashboard/$anything Any of the above URLS should work. You should NOT be able to do the following, dashboard controller should only be accessed by this single subdomain. !example.com/init/dashboard/function1 I don't care if I have to declare every controller in routes... I would have to do that in django/werkzeug/ruby/php/etc. I'm ready for web2py to get out of my way and let me do what I want to do. When I said rewrite hostname I ment to redirect a single hostname to a single web2py controller. This is the same concept as example1.com goes to app1 and example2.com goes to app2, but on the controller level instead of app level! (because the controllers share models) Hopefully this gets my point across. -Thadeus On Wed, Feb 17, 2010 at 12:03 AM, Jonathan Lundell jlund...@pobox.com wrote: On Feb 16, 2010, at 9:31 PM, Thadeus Burgess wrote: Ok I have spent way to long on this, I can't get any configuration of routes/mod_rewrite to rewrite the hostname. I think Massimo is right: you don't have any reason to rewrite the hostname. -Thadeus On Tue, Feb 16, 2010 at 10:51 PM, mdipierro mdipie...@cs.depaul.edu wrote: No you just need routes in to rewrite the hostname. Routesout just need to delete dashboard from path. On Feb 16, 5:37 pm, Thadeus Burgess thade...@thadeusb.com wrote: I can't find any apache rewrite rules that work in this manner. Basically i am just trying to get dashboard.example.com to internally rewrite web2py's URL scheme so that it looks at /init/dashboard but the user is still staring at dashboard.example.com in their browser. This means web2py routes_out will have to rewrite to the domain schema as well. it is not looking like I can accomplish this with routes or mod_rewrite. Massimo you have said you can redirect to two different apps depending on http_host, isn't this a similar situation? By the way. routes_in containing ('.*:https://dashboard.example.com:GET/(?any.*)', '/init/dashboard/\gany'), produces Traceback (most recent call last): [Tue Feb 16 16:14:58 2010] [error] [client File /home/servant/sites/themediapanel.com/public/web2py/wsgihandler.py, line 24, in module [Tue Feb 16 16:14:58 2010] [error] [client import gluon.main [Tue Feb 16 16:14:58 2010] [error] [client ] File gluon/main.py, line 105, in module [Tue Feb 16 16:14:58 2010] [error] [client ] rewrite.load() [Tue Feb 16 16:14:58 2010] [error] [client] File gluon/rewrite.py, line 65, in load [Tue Feb 16 16:14:58 2010] [error] [client params.routes_in.append((re.compile(k, re.DOTALL), v)) [Tue Feb 16 16:14:58 2010] [error] [client] File /usr/lib/python2.6/re.py, line 190, in compile [Tue Feb 16 16:14:58 2010] [error] [client ] return _compile(pattern, flags) [Tue Feb 16 16:14:58 2010] [error] [client ] File /usr/lib/python2.6/re.py, line 245, in _compile [Tue Feb 16 16:14:58 2010] [error] [client ] raise error, v # invalid expression [Tue Feb 16 16:14:58 2010] [error] [client] error: syntax error -Thadeus On Tue, Feb 16, 2010 at 5:06 PM, Thadeus Burgess thade...@thadeusb.com wrote: Can I do it for just one $c then, that is all I need. Every other controller will continue to function normally, this is only a special case controller. -Thadeus On Tue, Feb 16, 2010 at 4:35 PM, mdipierro mdipie...@cs.depaul.edu wrote: This cannot be done with routes (at least not unless you list all options for c). You can do this with mod-rewrite in apache. On Feb 16, 4:06 pm, Thadeus Burgess thade...@thadeusb.com wrote: No. example.com/$c/$f maps to /init/public/$c/$f and then dashboard.example.com/$f maps to /init/dashboard/$f I basically want $c.example.com/$f /init/$c/$f As I say this I kind of remember a post about this, search failing me. -Thadeus On Tue, Feb 16, 2010 at 4:02 PM, Wes James compte...@gmail.com wrote: forgot right bracket ] On Tue, Feb 16, 2010 at 2:59 PM, Wes James compte...@gmail.com wrote: On Tue, Feb 16, 2010 at 2:42 PM, Thadeus Burgess thade...@thadeusb.com wrote: I need to take the following with routes controller.website.com/action/args and convert it to /init/controller/action/args How can I do this, I have attempted to copy the book example however it is just giving syntax errors. This is a guess based on an example I saw: routes_in=[('/init/controller/action/args','/action/args') -wes -- You received this message because you are subscribed to the Google Groups web2py-users