title: ImportError: No module named django.core.wsgi (ubuntu)
body: <p>I am following this guide to configure apache for my django web application:
  <a href="https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/#basic-configuration" rel="nofollow">https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/#basic-configuration</a></p>
  
  <p>I have installed <a href="https://docs.djangoproject.com/en/1.9/topics/install/#installing-an-official-release-with-pip" rel="nofollow">Django</a>, <a href="https://pypi.python.org/pypi/mod_wsgi" rel="nofollow">mod_wsgi-express</a> (the <em>new</em> way) and <a href="https://www.digitalocean.com/community/tutorials/installing-mod_wsgi-on-ubuntu-12-04" rel="nofollow">mod_wsgi for apache</a> on an ubuntu 15.10 server using: </p>
  
  <pre><code>pip install Django
  pip install mod_wsgi
  sudo aptitude install libapache2-mod-wsgi
  </code></pre>
  
  <p>Next I have added the below to: <strong>/etc/apache2/apache2.conf</strong></p>
  
  <pre><code>WSGIScriptAlias / /home/user/mysite/mysite/wsgi.py
  WSGIPythonPath /home/user/mysite:/home/user/.local/lib/python2.7/site-packages
  
  &lt;Directory /home/user/mysite/mysite&gt;
  &lt;Files wsgi.py&gt;
  Require all granted
  &lt;/Files&gt;
  &lt;/Directory&gt;
  </code></pre>
  
  <p>But when I start apache I get the below error:</p>
  
  <pre><code>[Sat Mar 26 12:10:06.876025 2016] [wsgi:error] [pid 10622:tid 139806697674496] [client 217.40.250.17:52124]     from django.core.wsgi import get_wsgi_application
  [Sat Mar 26 12:10:06.876057 2016] [wsgi:error] [pid 10622:tid 139806697674496] [client 217.40.250.17:52124] ImportError: No module named django.core.wsgi
  </code></pre>
  
  <p>But that module indeed exists in the path I have supplied in <strong>WSGIPythonPath</strong> above:</p>
  
  <pre><code>~/.local/lib/python2.7/site-packages/django/core $ cat wsgi.py
  import django
  from django.core.handlers.wsgi import WSGIHandler
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>~/.local/lib/python2.7/site-packages $ ll
  total 24
  drwx------  6 user user 4096 Mar 24 22:25 ./
  drwx------  3 user user 4096 Mar 20 20:56 ../
  drwxrwxr-x 17 user user 4096 Mar 24 22:25 django/
  drwxrwxr-x  2 user user 4096 Mar 24 22:25 Django-1.9.4.dist-info/
  drwxrwxr-x  5 user user 4096 Mar 20 20:59 mod_wsgi/
  drwxrwxr-x  2 user user 4096 Mar 20 20:59 mod_wsgi-4.4.22.egg-info/
  </code></pre>
  
  <p>I also tried to validate the version of python the mod_wsgi module was build against:</p>
  
  <pre><code> /usr/lib/apache2/modules $ ldd mod_wsgi.so
      linux-vdso.so.1 =&gt;  (0x00007ffe50f31000)
      libpython2.7.so.1.0 =&gt; /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f376fbc2000)
      libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f376f9a4000)
      libc.so.6 =&gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007f376f5d9000)
      libz.so.1 =&gt; /lib/x86_64-linux-gnu/libz.so.1 (0x00007f376f3bf000)
      libdl.so.2 =&gt; /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f376f1bb000)
      libutil.so.1 =&gt; /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f376efb7000)
      libm.so.6 =&gt; /lib/x86_64-linux-gnu/libm.so.6 (0x00007f376ecaf000)
      /lib64/ld-linux-x86-64.so.2 (0x00005609838b3000)
  </code></pre>
  
  <p>So it appears it was build against Python 2.7 which is the same version Django is being installed under.</p>
  
  <p><strong>So why does apache fail to load my application/django?</strong></p>