title: wsgi.py no module named MySite
body: <p>I'm trying to start my Django application on Apache on Windows server.
  I have problem with the <code>wsgi.py</code> file.
  I got the following error in server log:</p>
  <pre><code> mod_wsgi (pid=1332): Target WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py' cannot be loaded as Python module.
   mod_wsgi (pid=1332): Exception occurred processing WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py'.
   Traceback (most recent call last):\r
     File &quot;C:/Apache24/htdocs/OctopusWeb/wsgi.py&quot;, line 11, in &lt;module&gt;\r
       import OctopusWeb\r
   ImportError: No module named 'OctopusWeb'\r
   mod_wsgi (pid=1332): Target WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py' cannot be loaded as Python module.
   mod_wsgi (pid=1332): Exception occurred processing WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py'.
   Traceback (most recent call last):\r
     File &quot;C:/Apache24/htdocs/OctopusWeb/wsgi.py&quot;, line 11, in &lt;module&gt;\r
       import OctopusWeb\r
   ImportError: No module named 'OctopusWeb'\r
   mod_wsgi (pid=1332): Target WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py' cannot be loaded as Python module.
   mod_wsgi (pid=1332): Exception occurred processing WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py'.
   Traceback (most recent call last):\r
     File &quot;C:/Apache24/htdocs/OctopusWeb/wsgi.py&quot;, line 11, in &lt;module&gt;\r
       import OctopusWeb\r
   ImportError: No module named 'OctopusWeb'\r
  </code></pre>
  <p>The <code>OctopusWeb</code> is the name of folder in which the <code>settings.py</code> and <code>wsgi.py</code> files are.</p>
  <p>My <code>wsgi.py</code></p>
  <pre><code>import os
  
  from django.core.wsgi import get_wsgi_application
  
  os.environ.setdefault(&quot;DJANGO_SETTINGS_MODULE&quot;, &quot;OctopusWeb.settings&quot;)
  
  application = get_wsgi_application()
  </code></pre>
  <p>All files I use are in <code>C:\Apache24\htdocs</code> directory.</p>
  <p>Do you have any idea what I did wrong?</p>
  <h3>Edit:</h3>
  <p>I edited <code>wsgi.py</code> as @JoranBeasley wrote</p>
  <pre><code>import os
  os.environ['PYTHONPATH'] = os.path.abspath(os.path.dirname(__file__))
  from django.core.wsgi import get_wsgi_application
  
  os.environ.setdefault(&quot;DJANGO_SETTINGS_MODULE&quot;, &quot;OctopusWeb.settings&quot;)
  
  application = get_wsgi_application()
  </code></pre>
  <p>and now I'm getting the following error</p>
  <pre><code>   mod_wsgi (pid=1108): Target WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py' cannot be loaded as Python module.
     mod_wsgi (pid=1108): Exception occurred processing WSGI script 'C:/Apache24/htdocs/OctopusWeb/wsgi.py'.
     Traceback (most recent call last):\r
      File &quot;C:/Apache24/htdocs/OctopusWeb/wsgi.py&quot;, line 16, in &lt;module&gt;\r
        application = get_wsgi_application()\r
      File &quot;c:\\python34\\lib\\site-packages\\django\\core\\wsgi.py&quot;, line 13, in get_wsgi_application\r
        django.setup(set_prefix=False)\r
      File &quot;c:\\python34\\lib\\site-packages\\django\\__init__.py&quot;, line 22, in setup\r
        configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r
      File &quot;c:\\python34\\lib\\site-packages\\django\\conf\\__init__.py&quot;, line 56, in __getattr__\r
        self._setup(name)\r
      File &quot;c:\\python34\\lib\\site-packages\\django\\conf\\__init__.py&quot;, line 41, in _setup\r
        self._wrapped = Settings(settings_module)\r
      File &quot;c:\\python34\\lib\\site-packages\\django\\conf\\__init__.py&quot;, line 110, in __init__\r
        mod = importlib.import_module(self.SETTINGS_MODULE)\r
      File &quot;c:\\python34\\lib\\importlib\\__init__.py&quot;, line 109, in import_module\r
        return _bootstrap._gcd_import(name[level:], package, level)\r
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 2254, in _gcd_import\r
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 2237, in _find_and_load\r
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 2212, in _find_and_load_unlocked\r
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 321, in _call_with_frames_removed\r
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 2254, in _gcd_import\r
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 2237, in _find_and_load\r
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 2224, in _find_and_load_unlocked\r
      ImportError: No module named 'OctopusWeb'\r
  </code></pre>