title: Mod_wsgi fails to load django.core.handlers.wsgi
body: <p>Ok, after 5-6 hours of trying, I give up. I have searched the web, tried all solutions suggested, but nothing is solving my problem.</p>
  
  <p><strong>Goal:</strong> Set up Django on my Ubuntu 12.04 VPS.</p>
  
  <p><strong>Problem:</strong> <code>Exception occurred processing WSGI script [...] ImportError: No module named django.core.handlers.wsgi</code> in /etc/log/apache2/error.log.</p>
  
  <p><strong>Solutions tried:</strong>  1) Appending the site-packages directory to the sys path in Djangos' wsgi.py file, 2) re-installing mod_wsgi, 3) making sure mod_wsgi is compiled for the same Python version as Django is installed with, 4) chmod 777 for the site-packages directory.</p>
  
  <p><strong>Environment:</strong>  Ubuntu 12.04 VPS, Django installation in virtualenv, Python version 2.7.3, Django version 1.6.1, mod_wsgi built from <a href="https://code.google.com/p/modwsgi/downloads/list" rel="nofollow">mod_wsgi-3.4.tar.gz</a>.</p>
  
  <p><strong>Full error message:</strong></p>
  
  <pre><code>mod_wsgi (pid=23691): Exception occurred processing WSGI script '/var/www/mySite/djangoSite/djangoSite/wsgi.py'.
  Traceback (most recent call last):
     File "/var/www/mySite/djangoSite/djangoSite/wsgi.py", line 7, in &lt;module&gt;
       import django.core.handlers.wsgi
  ImportError: No module named django.core.handlers.wsgi
  mod_wsgi (pid=23691): Target WSGI script '/var/www/mySite/djangoSite/djangoSite/wsgi.py' cannot be loaded as Python module.
  
  mod_wsgi (pid=23691): Exception occurred processing WSGI script '/var/www/mySite/djangoSite/djangoSite/wsgi.py'.
  Traceback (most recent call last):
     File "/var/www/mySite/djangoSite/djangoSite/wsgi.py", line 7, in &lt;module&gt;
       import django.core.handlers.wsgi
  ImportError: No module named django.core.handlers.wsgi
  </code></pre>
  
  <p><strong>Conf file from sites-available:</strong></p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerAdmin admin@mysite.com
      ServerName mysite.com
  
      DocumentRoot /var/www/mysite.com/djangoSite
  
      WSGIDaemonProcess djangoSite python-path=/var/www/mysite.com/djangoSite:~/Envs/myEnv/lib/python2.7/site-packages
      WSGIProcessGroup djangoSite
      WSGIScriptAlias / /var/www/mysite.com/djangoSite/djangoSite/wsgi.py
  
      Alias /static/ /var/www/mysite.com/djangoSite/static/
  
      &lt;Directory /var/www/mysite.com/djangoSite/static&gt;
          Order deny,allow
          Allow from all
      &lt;/Directory&gt;
  
      &lt;Directory /var/www/mysite.com/djangoSite/djangoSite&gt;
          &lt;Files wsgi.py&gt;
              Order deny,allow
              Allow from all
          &lt;/Files&gt;
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p><strong>wsgi.py:</strong></p>
  
  <pre><code>import os
  import sys
  
  sys.path.append('/var/www/mysite.com/djangoSite/')
  sys.path.append('/var/www/mysite.com/djangoSite/djangoSite/')
  
  activate_this = '/root/Envs/myenv/bin/activate_this.py'
  execfile(activate_this, dict(__file__=activate_this))
  
  os.environ['DJANGO_SETTINGS_MODULE'] = 'djangoSite.settings'
  
  import django.core.handlers.wsgi
  application = django.core.handlers.wsgi.WSGIHandler()
  </code></pre>
  
  <p><strong>Site structure</strong></p>
  
  <pre><code>/var/www/
  -- mysite.com
    -- djangoSite
      -- manage.py
      -- djangoSite
        -- settings.py, wsgi.py etc.
  </code></pre>