Apache Wsgi virtualHost, Django virtual env "no module named django.core.wsgi"
<p>I have seen plenty of previous messages related to my problem, but no answer could get rid of my &quot;500 Server internal Error&quot; so I try to post my conf to get help.</p>
<p>Error Message:</p>
<blockquote>
<p>[Fri Jun 24 17:05:23.631270 2016] [authz_core:error] [pid 15187:tid 140715758237440] [client 127.0.0.1:47873] AH01630: client denied by server configuration: /home/www/waves/</p>
<p>[Fri Jun 24 17:05:23.631568 2016] [:error] [pid 15186:tid 140715648984832] ['/home/marc/.virtualenvs/waves/lib/python2.7/site-packages', '/home/www/waves', '/usr/local/lib/python2.7/dist-packages/setuptools-20.6.7-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']</p>
<p>[Fri Jun 24 17:05:23.631660 2016] [:error] [pid 15186:tid 140715648984832] [remote 127.0.0.1:50665] mod_wsgi (pid=15186): Target WSGI script '/home/www/waves/waves_services/wsgi.py' cannot be loaded as Python module.</p>
<p>[Fri Jun 24 17:05:23.631675 2016] [:error] [pid 15186:tid 140715648984832] [remote 127.0.0.1:50665] mod_wsgi (pid=15186): Exception occurred processing WSGI script '/home/www/waves/waves_services/wsgi.py'.</p>
<p>[Fri Jun 24 17:05:23.631686 2016] [:error] [pid 15186:tid 140715648984832] [remote 127.0.0.1:50665] Traceback (most recent call last):</p>
<p>[Fri Jun 24 17:05:23.631710 2016] [:error] [pid 15186:tid 140715648984832] [remote 127.0.0.1:50665]   File &quot;/home/www/waves/waves_services/wsgi.py&quot;, line 18, in </p>
<p>[Fri Jun 24 17:05:23.631731 2016] [:error] [pid 15186:tid 140715648984832] [remote 127.0.0.1:50665]     from django.core.wsgi import get_wsgi_application</p>
<p>[Fri Jun 24 17:05:23.631743 2016] [:error] [pid 15186:tid 140715648984832] [remote 127.0.0.1:50665] ImportError: No module named django.core.wsgi</p>
</blockquote>
<p>My django app do not load in apache wsgi mode, I tried many solutions but still don't work. Here is my confs files :
Virtual host :</p>
<pre><code>&lt;VirtualHost *:80&gt;

ServerName dev.www.waves.com
ServerAlias www.waves.com
ServerAdmin webmaster@waves.com

DocumentRoot /home/www/waves
Alias media/ /home/www/waves/media/
Alias static/ /home/www/waves/static/

&lt;Directory /home/www/waves&gt;
   Require all granted
&lt;/Directory&gt;

&lt;Directory /home/www/waves/staticfiles&gt;
   Require all granted
&lt;/Directory&gt;

&lt;Directory /home/www/waves/media&gt;
   Require all granted
&lt;/Directory&gt;

WSGIDaemonProcess waves python-path=/home/marc/.virtualenvs/waves/lib/python2.7/site-packages:/home/www/waves
WSGIProcessGroup waves
WSGIScriptAlias /waves /home/www/waves/waves_services/wsgi.py

&lt;Directory /home/www/waves/waves_services&gt;
  &lt;Files wsgi.py&gt;
    Require all granted
  &lt;/Files&gt;
&lt;/Directory&gt;

&lt;Directory /home/marc/.virtualenvs/waves/lib/python2.7/&gt;
Require all granted
&lt;/Directory&gt;
</code></pre>

<p>My wsgy.py content :</p>
<pre><code>from __future__ import unicode_literals
import os
import sys
import site

print sys.path
from django.core.wsgi import get_wsgi_application
os.environ.setdefault(&quot;DJANGO_SETTINGS_MODULE&quot;, &quot;waves_services.settings.production&quot;)
application = get_wsgi_application()
</code></pre>
<p>I traced to sys.path content in apache error log, and the virtualenv in in sys.path.
Django is installed in this virtualenv (I had first tried to install django 'globally' but the error was just moved to the first 'application specific' import : environ contained in my settings file.
The virtual env was created with virtualenvwrapper (any impact ?)</p>
<p>I tried as well to change ownership of virtualenv file, changed 'execution' flag as well, but still I get this ... 500 Server Error.</p>
<p>I would be grateful to get a clue of what is happening !
thanxs</p>