On 10 Feb 2014, at 6:51 AM, Mauro Allegrini <mauro.allegr...@gmail.com> wrote: > Hi all > I'm trying to use virtual domains and a single web2py instance with multiple > apps, > My host is pythonanywhere.com. They have been kind but unable to help me on > this and suggested me to ask here. > > I've created PA domains, I've set up CNAME in my DNS and copied wsgi file to > make them all the same (as required by PythonAnywhere FAQ) > So far so good. > > The only part which is not working is the web2py routes.py: > > Here is the relevant part: > > > ------------------------------------------- > routers = dict( > > # base router > BASE=dict( > default_application='ivrdemoclient', > default_controller='script1', > default_function='index', > domains = { > "www.domain1.it":"parkmi", > "www.domain1.com":"parkmi", > } > ), > parkmi = dict( > default_controller='default', > default_function='index', > ) > ) > > ------------------------ > > Basically, I have a default app (without a formal domain, for now) and two > other domains www.domain1.it and www.domain1.com which should be routed to > parkmi web2py app > Instead when I open www.domain1.it the default app (and default controller > and function) show up as if domains key is ignored > > I've double checked DNS so that is not an issue. > > Can anybody help me? >
As usual, restart your server after making routes.py changes. Then make sure that HTTP_HOST in request.wsgi.environ matches the domain name in your domains dictionary. A minor point, and not relevant to your problem: I'd write the routers this way, so that app-specific defaults (in this case 'script1') are contained in app routers. routers = dict( # base router BASE=dict( default_application='ivrdemoclient', domains = { "www.domain1.it":"parkmi", "www.domain1.com":"parkmi", } ), ivrdemoclient = dict( default_controller='script1', ) parkmi = dict() ) -- 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/groups/opt_out.