Perhaps read thru the thread here - I thought Massimo did a nice job of explaining the flexibility and operation of routes.py here:
http://groups.google.com/group/web2py/browse_thread/thread/4768cc04ad88c48d# On Thu, Sep 24, 2009 at 12:37 PM, Jon Romero <[email protected]> wrote: > > I've spent the last two days trying to figure out a sane way to do > this and I still can't make routes.py work for domains > Please take a look here (http://groups.google.com/group/web2py/msg/ > 8616fc8bfc9c05a3<http://groups.google.com/group/web2py/msg/%0A8616fc8bfc9c05a3>). > Are routes.py not working for domains? > I think more examples are needed for mapping with domains. > > On Sep 14, 5:17 pm, mdipierro <[email protected]> wrote: > > Yes. You map domains into apps using routes. This in the manual, > > chapter 4. > > > > On Sep 13, 6:17 pm, Jon Romero <[email protected]> wrote: > > > > > When a request comes, the dispatch.fcgi is executed which contains > > > this: > > > > > #!/usr/local/bin/python2.6 > > > import os > > > import sys > > > > > os.chdir('/home/user/www/web2py') > > > > > path=os.path.normpath('/home/user/www/web2py/') > > > if not path in sys.path: sys.path.append(path) > > > > > import gluon.main > > > import gluon.contrib.gateways.fcgi as fcgi > > > application=gluon.main.wsgibase > > > > > if __name__ == '__main__': > > > from gluon.contrib.gateways.fcgi import WSGIServer > > > WSGIServer(application).run() > > > > > I create a domain pointer to /home/user/www.web2pysowhen I go to: > www.mydomain.com > > > it goes to the welcome page of web2py (runs the welcome app). > > > In order to run my app, I must to do this:www.mydomain.com/myapp > > > > > Of course I can rename my app to init (so it can run automatically) > > > but what > > > happens if I have two apps that need to be served from different > > > domains? > > > Is there a way for routes.py to understand which request comes from > > > that domain so it should serve that app? > > > > > On Sep 14, 1:59 am, mdipierro <[email protected]> wrote: > > > > > > Since you are talking aboutsharedhostingI assume you are using a > > > > third party like a web server, for example apache. > > > > > > If you have multiple installation your web server (apache) needs > > > > somehow to be able to discriminate which one you one you want to talk > > > > to. This can be done using the hostname (different virtual hosts), > via > > > > appname (/app1/default/index go to web2py1 and /app2/default/index > > > > goes to web2py2), or by prepending a prefix to the appname (/web2py1/ > > > > app/default/index goes to web2py1 and /web2py2/app/default/default/ > > > > index goes to web2py2). > > > > > > In all of these cases routes can be used to add or remove parts of > the > > > > url received by web2py. > > > > > > If you have a single application a single web2py installation you can > > > > do > > > > > > routes_in=(('/index','/myapp/default/index'),) > > > > > > to do the mapping you ask. > > > > > > Massimo > > > > > > On Sep 13, 5:00 pm, Jon Romero <[email protected]> wrote: > > > > > > > I am writing a tutorial on how to install web2py onsharedhosting > > > > > acounts. > > > > > I have managed to install and use it successfully but I have a > problem > > > > > with routes. > > > > > > > So, I have created a domain pointer to /home/myuser/www/web2py > > > > > (yeap I know I should put web2py outside of public but this senario > > > > > will make it easier to explain the pointer). > > > > > > > Then I created a dispatcher and an .htaccess and everything works > > > > > lovely. > > > > > When I go to my domain pointer, I get redirected to: > http://mydomain.com/welcome/default/index > > > > > > > This creates two problems: > > > > > 1. What if I have two (or more) websites/applications using the > same > > > > > web2py installation? > > > > > Is it possible? > > > > > 2. My links are now like that: > http://mydomain.com/application_name/default/index > > > > > while I wantedhttp://mydomain.com/index. > > > > > This seems like a route.py problem, but what happens if there are > two > > > > > websites/applications? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

