1

I'm using Apache & mod_wsgi to deploy a django application on several servers. I've read in multiple places (including this: http://blog.dscpl.com.au/2012/10/why-are-you-using-embedded-mode-of.html) that it's better to use the Daemon mode of wsgi. This would allow me to have control over process count and thread count per process, among other neat things :)

Now my is that I can have two or more instances of my django application on the same server (with each its own settings, databases, etc). For example:

  • http://team1-server/prod-instance
  • http://team1-server/test-instance

Tough I think I understand how to use a different "process group" and "daemon process" configuration for multiple virtualhosts, i don't seem to wrap my mind around what i should do with multiple "sub-roots".

EDIT:

I run those under CentOS 6.2 distros. In the /etc/httpd/conf.d/ directory I have one .conf file for each instance which looks like this:

WSGIScriptAlias /prod-instance /opt/wsgi_applications/prod/app.wsgi

END EDIT.

Should I use virtualhosts and have urls such as http://prod-instance.team1-server/ instead? That would mean I should rely on the network managers to update the DNS tables, which is never fast enough for our clients. :)

I must admit I'm often lost when it comes to Apache configuration. Your help is welcome.

Thanks!

O.

1 Answer 1

3

Presuming you are not using a very old obsolete mod_wsgi version, you can say:

WSGIDaemonProcess prod-instance
WSGIScriptAlias /prod-instance /opt/wsgi_applications/prod/app.wsgi process-group=prod-instance application-group=%{GLOBAL}

WSGIDaemonProcess test-instance
WSGIScriptAlias /test-instance /opt/wsgi_applications/test/app.wsgi process-group=test-instance application-group=%{GLOBAL}

If you are using a very old obsolete mod_wsgi version, instead use:

WSGIDaemonProcess prod-instance
WSGIScriptAlias /prod-instance /opt/wsgi_applications/prod/app.wsgi
<Location /prod-instance>
WSGIProcessGroup prod-instance
WSGIApplicationGroup %{GLOBAL}
</Location>

WSGIDaemonProcess test-instance
WSGIScriptAlias /test-instance /opt/wsgi_applications/test/app.wsgi
<Location /test-instance>
WSGIProcessGroup test-instance
WSGIApplicationGroup %{GLOBAL}
</Location>
3
  • Hey @graham-dumpleton, could you enlighten me about what would be an obsolete version of mod_wsgi? I have the official package for CentOS 6.2, so that would be at least 3.2 I think. I guess that's quite up-to-date.
    – Olivier H
    Sep 24, 2013 at 7:05
  • Version 3.2 is over 4 years old. That is not recent. Sep 24, 2013 at 23:13
  • Oh yeah, CentOS often has old official packages. :-( But it seems it's recent enough to accept the newer syntax. Tested and accepted.
    – Olivier H
    Sep 25, 2013 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .