I am looking to get two (or even more) Django programs setup at subdirectories underneath the same domain, e.g.:

http://example.com/site1/
http://example.com/site2/

I understand that normally this works fine by establishing an apache virtualhost such as this:

<VirtualHost *:80>
    ...
    WSGIScriptAlias /site1 /path/to/site1.wsgi
    WSGIScriptAlias /site2 /path/to/site2.wsgi
</VirtualHost>

Now, I have verified that every site works individually. However when I attempt to operate both side-by-side, apache transmits me to whichever site the staff member process loaded first. Example:

  1. Restart apache set up for everyone 6 threads
  2. Load example.com/site1/, obtain the correct page
  3. Load example.com/site2/, obtain the correct page
  4. Repeat 2 and three 2 more occasions.
  5. Refresh example.com/site1/ frequently, watch it cycle from site to site.

Effectively, for just about any given quantity of worker processes, it cycles with the final amount of these delivering the request to whichever one it hit first no matter the WSGIScriptAlias directive. Regardless of what I actually do (setting WSGIProcessGroup, daemon mode versus. embedded mode, or directives) it is constantly on the exhibit this behavior.

If anybody can explain what I am doing wrong here, that might be phenomenal!

I have had multiple WSGI applications running on one Apache install, and located the simplest factor to complete is simply have multiple process groups-Body for each one of the applications.

One downside, versus really looking to get just one process to operate both (or even more) applications, is this fact would use a bit more resident memory than you can get away with otherwise. However it keeps them pretty much separated and eliminates hassle. Which is probably not an issue for you personally (it had not been for me personally).

(May possibly not be that bad either, they may have the ability to share lots of text pages? That's just idle speculation I've not verified this by any means, as my setup wasn't whatsoever memory-starved)

Here's some clips of my httpd.conf, roughly:

WSGIDaemonProcess khdx_wsgi user=galdosd group=galdosd maximum-requests=10000
WSGIScriptAlias /khdx /home/galdosd/khdxweb/rel/khdx/apache/django.wsgi
<Location /khdx>
WSGIProcessGroup khdx_wsgi
</Location>

WSGIDaemonProcess sauron_wsgi user=galdosd group=galdosd maximum-requests=10000
WSGIScriptAlias /sauron /home/galdosd/finalsauronweb/django-root/apache/django.wsgi
<Location /sauron>
WSGIProcessGroup sauron_wsgi
</Location>

I have had challenge with this myself. Rather than looking to get the Apache configuration right, I made the decision rather to utilize a single WSGIScriptAlias and also have WSGI middleware which routed demands towards the correct programs. My code reaches https://github.com/zhemao/flotilla. I've not examined it much, so utilize it with caution, however i hope it will help.