Hi!
Is it possible to have one Django project with 3 apps served by one PA's web app for 3 custom domains?
I read few posts here with similar but not the same task. As opposed to those problems I do not mind just adding few more web app slots $2 each and deploy three more Django projects with custom domains.
My situation is that I have three websites targeted at slightly different audiences with 80% of shared code and content (same database of currencies, exchange rates, prices, etc, but with different sales points and marketing campaigns). Rolling out three separate Django projects is easy, but who wants to update and maintain that shared code later x 3 times per each commit...
Fortunately, since the project is one and the same, the (a) static files, and (b) environment variables, and (c) virtual environment will be the same, shared. I don't have to worry about that.
From what I got so far, it seems that I shall configure WSGI file to do:
- if request comes from domain1, load same project with Django.settings1 (with site ID=1 and root urls serving App1 by default)
- if request comes from domain2, load same project with Django.settings2 (with site ID=2 and root urls serving App2 by default)
Questions:
-
Is this the right way to do it? I read about dynamicsites, but not sure if I need to refactor the project for the new extension if I can only rewrite few lines in WSGI file.
-
If so, could you help me and tell how to write the "routing" lines in WSGI? (Unfortunately, I am not good at WSGI configuration, never did it)