Forums

Using my own domains with multiple web2py applications

Hello,

I have 2 domains, and 2 web2py applications running in the same web2py folder. For both I've set a CNAME in my domain provider to cenkoloji.pythonanywhere.com. but of course they both open up my default application.

Is there a way to set routes.py or wsgi file to make domains direct to different aps?

Hi cenkoloji,

Sounds like you have done everything right so far. But your wsgi.py files are both loading the same Web2Py application? Would that be correct? The wsgi.py files that we create after a quickstart have a project_home variable that points to the folder of the application you want to load. Have a play with that.

Cheers

Thanks for the answer,

I tried that. In wsgi file when I enter:

project_home = u'/home/cenkoloji/web2py/applications/appname/'

instead of

project_home = u'/home/cenkoloji/web2py/'

I get "unhandled exception" when I go to my site. Surely I can create a totally new web2py folder. I am curious if it is possible to host more than one apps it in the same web2py folder.

Heh.

Join the club:

https://www.pythonanywhere.com/forums/topic/563/

@cenkoloji: you cannot host two websites from the same web2py folder, unless you can figure out a way of telling web2py to select the active application by looking at the requested hostname.

Instead, if you install web2py twice in two different folders, using our quick-start wizard, once for each domain, and then set the default application for each.

Now this is weird. There is a link in topic 563 pointing here...and one above pointing there...☺