title: ImportError: No module named django.core.wsgi
body: <p>I'm moving a web application from a Windows environment to CentOS 5.11 and Apache, and with everything installed, I'm receiving a <code>500</code> when I try to load up the site. The error log shows this:</p>
  
  <pre><code>mod_wsgi (pid=5461): Target WSGI script '/usr/local/treehouse/wsgi/index.wsgi' cannot be loaded as Python module.
  mod_wsgi (pid=5461): Exception occurred processing WSGI script '/usr/local/treehouse/wsgi/index.wsgi'.
  Traceback (most recent call last):
    File "/usr/local/treehouse/wsgi/index.wsgi", line 11, in &lt;module&gt;
      from django.core.wsgi import get_wsgi_application
  ImportError: No module named 'django.core.wsgi'
  </code></pre>
  
  <p>I found <a href="https://stackoverflow.com/q/14927345/2069350">this question</a> (and the related ones), which appears to be similar but none of the answers there fix the issue. I'm <em>not</em> running in a <code>virtualenv</code>, and django appears to be installed correctly, as I can run the offending statement:</p>
  
  <pre><code>&gt;&gt;&gt; from django.core.wsgi import get_wsgi_application
  </code></pre>
  
  <p>in the interactive Python interpreter and it works <em>just fine</em>. Here's the script causing the error (it's just the default <code>index.wsgi</code> that you see everywhere you look for this stuff):</p>
  
  <pre><code>import os, sys
  sys.path.append('/usr/local/treehouse/apple')
  sys.path.append('/usr/local/treehouse/apple/apple')
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "apple.settings")
  
  from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
  </code></pre>
  
  <p>Obviously the last line causes the error, but here's the fun part: the last line <em>remains</em> the problem, even if I add this just above it:</p>
  
  <pre><code>import django.core
  import django.core.handlers
  </code></pre>
  
  <p>Both of the underlying packages import without a hitch (<code>django.core.wsgi</code> is just a thin wrapper around some functionality in <code>django.core.handlers.wsgi</code>). It's only when I try to access the <code>wsgi</code> packages that problems occur. Inspecting <code>sys.path</code> within this script shows all the right directories (<code>/usr/local/lib/python3.4/site-packages</code>, etc.). And again, running the exact same code from the interactive interpreter causes no errors. </p>
  
  <p>I tried an uninstall/reinstall of django (<code>pip install django==1.6.5</code>), then I reset the VM to a totally clean snapshot and rebuilt/reinstalled <em>everything</em>, and still I get the exact same behavior.</p>
  
  <p>What is going on?</p>