Search code examples
djangonginxgunicorndjango-deployment

How to run a single django project for different customers


I have developed a web application named “SANET” using django, gunicorn and nginx for a customer named customerA and gave them access using customerA.mydomain.com.

Now a new customer customerB has ordered a dedicated version.

Here is what I think I could do (I want them all on a particular server):

  1. make a copy from project and deploy it on customerB.mydomain.com like a compeletly different project
  2. find a way to just change the project database config depending on which domain is requested

It would be appreciated if you can guide me to choose one of these options or offer me a better way.


Solution

  • Many clients using one system is known as "multi-tenancy", or multi-tenant systems.

    Here is a comparisson of django packages that could be useful for that. I suggest you read the docs and reviews of a few of them to get an idea of how they work and if they are suitable for you.


    But if there is even the slightest chance that one of your clients will want additional customizations in the future, then I suggest you run them on separate django instances (separate database and gunicorn, but you could use only one nginx).

    This separation makes development and maintenance simpler than coding with ifs to distinguish customers.