Thanks for your time Massimo. I didn't know about multi-tenancy in web2py, I've just read a little about that. However I think it's not what I need in this case (but I've just read about multi-tenancy).
Let me give some additional details of my case regarding databases (I realised that I didn't mention it in the previous post): Each domain uses its own database. Each domain serves two applications. This two applications share the same database , through symlinks the following folders: databases, models and private. So in web2py/applications/ I would have: ... panel1/ panel1/databases/ panel1/models/ panel1/private/ site1/ site1/databases --> symlink to ../panel1/databases site1/models --> symlink to ../panel1/models site1/private --> symlink to ../panel1/models ... and the same structure repeats itself for site2, site3, etc. A new site is added from time to time. Then I would like each domain accesses applications like this: http://site1.dev/ ---> /site1/default/index http://site1.dev/panel ---> /panel1/default/index http://site1.dev/panel/default/user/login ---> /panel1/default/user/login http://site2.dev/ ---> /site2/default/index http://site2.dev/panel ---> /panel2/default/index http://site2.dev/panel/default/user/login ---> /panel2/default/user/login So, each domain (each pair of "siteX" and "panelX" applications) will have its own database, with its own users and permissions. I don't know if this info helps or I've missed the point somewhere :P 2015-04-15 10:51 GMT-03:00 Massimo Di Pierro <massimo.dipie...@gmail.com>: > Did you look into multi tenancy in web2py? > > You can use routes to map the domain into applications but do not use it > to map domains. Use multi tenancy to have different domains map into > different slices of the database with their own permissions. > > > On Wednesday, 15 April 2015 08:00:35 UTC-5, Lisandro wrote: >> >> I have multiple domains with multiple applications. I've gotten it to >> work using routes.py, with both approaches: parameter-based and >> pattern-based system. However, there's a couple of things that still I >> can't achieve. >> >> >> 1) Two applications per each domain >> In my case, each domain serves two applications: the main one, and a >> second one. I need the main one to be accessible through / url. And I need >> the second one to be accessible through an url that is different to the >> application name. To clarify: >> >> *http://site1.dev <http://site1.dev>* ----> should serve >> *site1* app >> *http://site1.dev/panel <http://site1.dev/panel>* ----> should serve >> *panel1* app >> >> *http://site2.dev <http://site2.dev>* ----> should serve >> *site2* app >> *http://site2.dev/panel <http://site2.dev/panel>* ----> should serve >> *panel2* app >> >> Notice that every domain should have the /panel url pointing to the >> corresponding application (panel1, panel2, etc). >> >> >> 2) Restrict access to specific application according the domain >> Whether is parameter-based or pattern-based system, all domains endup >> having access to all applications, for example, http://site1.dev/site2/ >> is showing site2 application. But I would like that the domain >> *site1.dev* can only access the applications site1 and panel1, and >> nothing else. >> >> >> >> What have I achieved so far? >> >> ------------ routes.py using parameter-based system ----------------- >> # -*- coding: utf-8 -*- >> >> routers = dict(BASE = dict(\ >> domains = {\ >> 'site1.dev':'site1', \ >> 'site2.dev':'site2', \ >> })) >> >> >> This approach is working, however I don't know how to make */panel* url >> to serve *panel1* application. Also, the problem of the point 2 remains: >> all domains can access all applications. >> >> >> ------------ routes.py using pattern-based system ----------------- >> # -*- coding: utf-8 -*- >> >> routes_in = ( >> ('.*http://site1.dev.* /*', '/site1'), >> ('.*http://site2.dev.* /*', '/site2')) >> >> >> In this case, in addition to the aforementioned problems, I see an error >> on every url that is not default/index. That is, http://site1.dev/ shows >> the default/index, but if I click, let's say, on the register url, the >> browser attempts to load site1.dev/site1/default/user/register but I >> receive an "invalid function" error. >> >> >> At this point, I'm a bit lost. I'm using nginx, and I asume all this >> could be done through nginx's rewrite module (however I would like to keep >> it inside web2py, for portability reasons). >> Also, I must say I've never worked with regular expressions, and in >> addition, as you can see, this scenario is a little bit different than the >> classic one-app-per-domain. >> >> So, I would really appreciate any advice or help on this. >> >> P/S: if someone feels sufficiently trained to resolve the situation, >> please contact me by private, I'm willing to spend some money to resolve >> this situation in a professional manner. >> > -- > 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/lJWJ8tYEhi4/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > 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.