Forums

Multiple Web2py Appas

I have 2 apps already in my web2py folder with 2 different domains. I remember when I set up the second app I had a lot of trouble, the process was confusing. However, they seem to be working, although I don't think I did it right. This was a while ago so I don't really remember how I finally got it to work but I think I never configured or edited the WSGI file manually.

I am about to launch a new app with a new domain, this will be the third one in the web2py folder. I want to do this right. What is the easiest, simplest way to do this? I really don't want to do any manual configuration for the WSGI file if possible unless I have a step by step instruction.

I would appreciate some help with this.

Thanks.

HI there, we're not web2py experts here, but if you have it working for two sites already, I would recommending using "Manual config", and then copy-pasting the contents of one of your existing wsgi files into the new one, and then modifying it as appropriate...

It might be worth posting on the web2py forums asking for "best way to host multiple apps/domains on pythonanywhere?" -- there are probably some more knowledgeable people on there...

Point us to the thread if you do, maybe we can write up a best practice and put it on our wiki...

I did the manual config, I copied the contents of one of my existing wsgi file to the new app wsgi file and it doesn't work at all. I also posted this question on the web2py forum but no answer. Now, what do I do? My new app is not in the web2py directory, it's not anywhere where I can find it.

I can't even restart the process because if I try to add a new app I get the reached my limit msg I really need help with this! Your instructions for hosting multiple web2py apps/domains are not clear. You said in your reply that we're not web2py experts here but I am not a pythonanywhere expert. I'd appreciate some advise.

I worked it out, I think. It seems to be working now.

Hooray! Is there anything you can share with the forums, in case anybody else needs to do the same thing?

I am not sure exactly how I finally set this up and I can't replicate the process unless I delete the app and start over which I am not going to do now.

This is what I think I did:

First, I chose the "manual configuration" then edited my WSGI file as instructed here: https://www.pythonanywhere.com/wiki/MultipleDomainsWeb2py

After this it was impossible to continue in any way. In the WSGI file I changed the folder name, adding the new folder name that I wanted to set up for the new app but there was no way to actually create the folder at that point. So after a while I deleted the app, there was nothing else I could do. There is probably a way to start setting up the folder structure manually but that doesn't seem like a good idea to me.

After the app was deleted, the WSGI file was not deleted so I started to "add a new app" again but this time I did not choose "manual configuration", and then, it worked. The folder was created, everything seems to be working.

What did I miss? It seems to be working fine this way. I'd appreciate any feedback or advise.

Ah not sure if there is a misunderstanding here. To clarify:

  • to setup multiple web2py websites, and to set up the new website from scratch, you can just do create new (non-custom) from our web tab.
  • to get multiple domains to point to the same web2py code, then you should proceed as mentioned in our wiki.

My understanding is that even if I don't want multiple domains to point to the same web2py code, I still have copy the code from the first app's WSGI file only editing the folder name, right?

You only need to edit the folder name if your web2py code is in a new location. I couldn't tell from your description if you've moved the code.