Multiple instances of Django on one machine

Asked

Viewed 41 times

-2

I have a project in Django that works as a web application for use in companies. The company has 4 branches, and we have a server available.
The goal is to replicate the 4x project on the same machine, each with an isolated database. Each branch only accesses one instance, but all must be available simultaneously, and on the same machine.
I’m using NGINX to serve applications.
At this time, I have several "server" blocks aimed at different ports operating as proxy Reverse of various Django applications running on the terminal. I copied the project folder to 4 different folders within /var/www and changed the name of the database to isolate the users and the data of each one. At this moment, for example:
Affiliate 1 goes to: http://domain:80/
Affiliate 2 access: http://domain:90/; ...
Is there a more efficient or correct solution to make the application available? Race conditions may occur to access the database or some kind of problem running multiple instances of Django on the same machine?

1 answer

0

What you’re doing is acceptable.

If the 4 branches, will always use the same system, you could keep 1 code only on the deploy and use multiple Settings ?

Your gunicorn strings could point to different Settings ... This will make it easier to deploy upgrades.

Another thing that could , but should still be debatable, would be to use Django sites. Which was made to have several "branches" using the same Django project. But you would probably have to change the code of your application ... from one studied and maybe stay for version 2.0

You do not need to use the same database, SINCE you put the different databases in the same database instance (I hope you are using postgresql) would make it easier to have EXTRA membership reports. I hope I helped. Good luck

Browser other questions tagged

You are not signed in. Login or sign up in order to post.