[Answered ]-How do I run more than one Django site on a single server using fastcgi?

2👍

✅

It depends on what you mean by site, and what your Django configurations look like.

Each Django settings.py defines one and only one database, one and only one urls.py tree.

Each Django has one settings.py — one database — one urls.py tree.

If each site has a distinct database, they need distinct settings.py and you’d need a distinct fastcgi instance.

If all sites a supported by a single database, with a single settings.py, then you can squeeze them all out of a single fastcgi instance.

Note that Django’s urls.py handler mostly ignores the hostname and port number in the url parsing in the request. However, if you include the Sites model, you can have the virtual host name become part of request processing.

0👍

For what it’s worth you can do away with the tcp overhead and use a socket instead:

/home/django/app1/manage.py runfcgi protocol=fcgi socket=/var/run/mysite.sock

sockets must be readable and writable for the webserver user.

Leave a comment