I've just figured it out. I wasn't thinking right.
I realised that, instead of having each site accesing its panel through 
those kind of urls (site1.dev/panel, site2.dev/panel, etc), I could use 
subdomains like panel.site1.dev, panel.site2.dev, etc, and then the thing 
is as easy as editing routes.py with parameter-based routing system, like 
this:

# -*- coding: utf-8 -*-
routers = dict(\
  BASE = dict(\
    domains = {\
      'site1.dev':'site1', \
      'panel.site1.dev':'site1_panel', \
      'site2.dev':'site2', \
      'panel.site2.dev':'site2_panel', \
    }, \
  )\
)



El miércoles, 15 de abril de 2015, 10:00:35 (UTC-3), Lisandro escribió:
>
> 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 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.

Reply via email to