Search code examples
djangoapache2wsgidjango-wsgidjango-sites

django + wsgi + multiple sites


I have a django-app using sites framework and need to deploy in a single apache virtual host. I was using mod-python with PythonInterpreter and it was working fine. But mod-python is deprecated and I want to migrate to wsgi. But I can figure out how to configure this scenario using wsgi. Can anyone help me? I guess just using WSGIScriptAlias for each site is not working because it is running on same python interpreter.

Can anybody help me?


Solution

  • The default for WSGIApplicationGroup is %{RESOURCE} which expands to include the value of ServerName and the application mount point. Thus each distinct virtual host would be in separate sub interpreter by default.

    This means that if you have multiple VirtualHost definitions with different ServerName setting then they would be distinct.

    In general though, it would be better to create a distinct daemon process group for each site and delegate each to a different set of processes. This is done using WSGIDaemonProcess and WSGIProcessGroup directives.

    When each site is in a separate daemon process group, then often better to set WSGIApplicationGroup to %{GLOBAL} so using main interpreter in process as that avoids some issues with third party C extension modules for Python which aren't written so as to work in sub interpreters.