On Oct 30, 10:31 pm, Web2Py Freak <halna...@gardeniatelco.com> wrote:
> My app name is 'Web2py'  and in it i have two 'web2py app':
>
> 1- welcome
> 2-maestro
>
> now i have a domain and in the site app i selected web2py and there is
> nothing in the path so it takes the welcome app
>
> and now i have some other domain and i want it to start mastro web2py
> app  .. i will select web2py and then what to add in the URL path ???


If ALL your other domains only need ONE SAME "web2py app" named
mastro, you are lucky. You only need to rename "mastro" as "welcome"
or "init". Problem solved.

If, in my cases, different domain needs different web2py app to serve,
I use a naive trick. Here is my "web2py app" welcome/default.py 's
index():
Well, my simple

def index():  # serves as a springboard
    if request.env.http_host.endswith('site_alpha.com'):
        redirect(URL(a='alpha',c='default',f='index'))
    if request.env.http_host.endswith('site_beta.com'):
        redirect(URL(a='beta',c='default',f='index'))
    ...

You get the idea.

It is not perfect. End users see a long url, e.g.
http://www.site_alpha.com/alpha/default/index
Besides, if site alpha 's end user types in 
http://www.site_ALPHA.com/BETA/default/index,
oops, he sees contents in site beta. I can live with that. How about
you?

It is possible to use web2py's builtin url rewriting feature, or
nginx's url rewrite feature, which should be faster by the way. But I
did not go that far yet. People who've been there please give some
light.

Regards,
Ray

Reply via email to