Hi everyone,

I'm hoping to confirm my understanding on how to deploy multiple Django 
websites using the same database, using postgres and gunicorn/nginx. 

Doing this seems to me as simple as:
1. Creating a copy of the Django project in its own directory, with its own 
settings.py etc.
2. Keep the same settings.DATABASES the same, i.e. pointing to the same 
postgres server.
3. Deploy the new site as if were a standalone site, e.g. separate 
/etc/nginx/sites-available/new-site-name.conf etc.

Of course doing the above wouldn't be very useful unless the two sites did 
something different. For instance, to have them by default work on 
different subsets of the data, I could use the Django sites framework, 
where the CurrentSiteManager restricts queries to data associated with the 
specific site baed on settings.SITE_ID. The two sites could still access 
all data using standard model managers, and there would be no problem 
having models associated with one site link to models from another site via 
related fields as normal, as long as the model's default manager could see 
all data.

Core Django tables like User and Permissions would be shared between the 
two sites, so if a user has access to one site, they will have access to 
the other site.

As for race conditions, there are no particular new issues raised by two 
sites sharing the same database, i.e. race conditions could happen but it's 
no different than with multiple requests on a single site.

Have I got all that right? Anything I'm missing? Is it really as simple as 
just having two Django sites point to the same database via 
settings.DATABASES?

Thanks,
Ien  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1845301e-bca7-43ea-8101-d3fe860ba202%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to