Configuring virtualhosts in uWSGI?

I want to try to do two sites with one backend.
Plan to use Django-sites-framework + uWSGI + NGINX. For configuring the necessary network, like information, but in conjunction Django-sites-framework + uWSGI managed to find not much. As I understand from what has been read - need to configure virtualhosts socket and uWSGI to route the requests to the appropriate sites. Does anyone know how to set the example of two domains?
Thanks in advance.
March 23rd 20 at 19:08
1 answer
March 23rd 20 at 19:10
The example of my problem: one database on several similar sites, it was necessary to display different home page to load a little different css styles, contacts, etc.

ALLOWED_HOSTS = ['', '', '']

Don't forget to migrate.
Will appear in the admin section "sites" where you can add domains '', '', ''.

current_site = get_current_site(request).domain # you can use the id, but it seemed clearer to use a domain
if current_site == '':
 # ...some logic-for example, different context or template
elif current_site == '':
 # ...some logic-for example, different context or template

For nginx, everything is simple, for each domain, create a config, they just lead to the same place (socket/port ), you can create a single config, with if etc. but for me it is uncomfortable.

location / {
 # in the socket
 proxy_pass http://unix:/tmp/example.socket; 
 # to the port, pick one
 proxy_set_header Host $server_name;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

There is another option when you need a completely different logic, then multiple files are created
And numbered SITE_ID=1, SITE_ID=2, SITE_ID=3

For uWSGI I can't remember if there's nuances, I have been using gunicorn (used)
But no special settings different from the usual do not need:
gunicorn --bind unix:/tmp/unix:/tmp/example.socket project.wsgi:application

Find more questions by tags uWSGINginxDjango