WSGI: Django App is not getting the required site-packages
<p>Unfortuanetely I am stuck with my Website returning a 500 error.</p>

<p>The apache log is not really specific, and so I do not really know what to do. Before some apt-get upgrades everything worked fine.</p>

<p>I do think this might be a permission error. How do I have to set the permissions working with WSGI?</p>

<p>Or do you know why this problem could be occuring for another reason?</p>

<p>apache conf:</p>

<pre><code>...
WSGIDaemonProcess aegee-stuttgart.org  python-path=/home/sysadmin/public_html/aegee-stuttgart.org:/home/sysadmin/.virtualenvs/django/lib/python2.7
    WSGIProcessGroup aegee-stuttgart.org
    WSGIScriptAlias / /home/sysadmin/public_html/aegee-stuttgart.org/aegee/wsgi.py
...
</code></pre>

<p>wsgi.py:</p>

<pre><code>...
import os, sys

# add the aegee project path into the sys.path
sys.path.append('/home/sysadmin/public_html/aegee-stuttgart.org/aegee')

# add the virtualenv site-packages path to the sys.path
sys.path.append('/home/sysadmin/.virtualenvs/django/lib/python2.7/site-packages')
import django
from django.core.handlers.wsgi import WSGIHandler
...
</code></pre>

<p>error.log:</p>

<pre><code>mod_wsgi (pid=23202): Exception occurred processing WSGI script '/home/sysadmin/p$
Traceback (most recent call last):
 File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/wsgi.py", line 31, i$
   return super(WSGIEnvironment, self).__call__(environ, start_response)
 File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 189,$
   response = self.get_response(request)
 File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 218,$
   response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
 File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 264,$
   if resolver.urlconf_module is None:
 File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 395, $
   self._urlconf_module = import_module(self.urlconf_name)
 File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
   __import__(name)
 File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/urls.py", line 8, in$
   from .userprofile.views import AccountPersonalInfoView
 File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/userprofile/views.py$
   from django.contrib.auth.mixins import LoginRequiredMixin
ImportError: No module named mixins
</code></pre>

<p>Use:</p>

<pre><code>WSGIDaemonProcess aegee-stuttgart.org python-home=/home/sysadmin/.virtualenvs/django python-path=/home/sysadmin/public_html/aegee-stuttgart.org
</code></pre>

<p>not what you had. It is possible to use <code>python-path</code> to refer to a virtual environment, but you were using the wrong directory. Use <code>python-home</code> instead and set it to same directory as <code>sys.prefix</code> gives for the virtual environment.</p>

<p>Because you were using wrong directory, it was picking up Django from main Python installation and not the virtual environment.</p>

python django mod-wsgi