title: Django deployment with mod_wsgi on WAMP
body: <h2>Context</h2>
  
  <ul>
  <li>Python 2.7 64bit </li>
  <li>Django 1.3</li>
  <li>WAMP 2.2 (Apache 2.2.22) 64bit</li>
  <li>mod_wsgi 3.4 64bit</li>
  <li>Windows 7 64bit</li>
  </ul>
  
  <h3>Detail | Apache httpd.conf</h3>
  
  <pre><code>...
  Listen 192.168.20.11:8080
  ...
  LoadModule wsgi_module modules/mod_wsgi.so
  ...
  ServerName 192.168.20.11:8080
  ...
  DocumentRoot "c:/wamp/www/"
  ...
  &lt;VirtualHost *:8080&gt;
  
      ServerName 192.168.20.11
      ServerAdmin me@mine.com
  
      DocumentRoot "C:/wamp/www/myapp"
  
      &lt;Directory "C:/wamp/www/mapp"&gt;
      Order allow,deny
      Allow from all
      &lt;/Directory&gt;
  
      Alias /myapp/static "C:/wamp/www/myapp/static"
      WSGIScriptAlias /test "C:/wamp/www/myapp/wsgi.py"
  
  &lt;/VirtualHost&gt;   
  </code></pre>
  
  <h3>Detail | wsgi.py</h3>
  
  <p>Generated by Django's startproject. Located at default /myapp/myapp/wsgi.py</p>
  
  <pre><code>import os
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
  from django.core.wsgi import get_wsgi_application
  application = get_wsgi_application()
  </code></pre>
  
  <h2>Problem</h2>
  
  <p>Cannot deploy Django app on WAMP given the context described above.</p>
  
  <p>A "Hello World" test wsgi application works fine, so I have confirmed that mod_wsgi is active.</p>
  
  <p>I get the error:</p>
  
  <blockquote>
    <p>Internal Server Error</p>
    
    <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p>
    
    <p>Please contact the server administrator, me@mine.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.</p>
    
    <p>More information about this error may be available in the server error log.</p>
  </blockquote>
  
  <p>when pointing to:</p>
  
  <pre><code>http://192.168.20.11:8080/myapp
  </code></pre>
  
  <p>The static folder works fine, I can access all static files within the directory by pointing to:</p>
  
  <pre><code>http://192.168.20.11:8080/myapp/static
  </code></pre>
  
  <h3>Detail | Server error log</h3>
  
  <p>NB: I've removed the timestamps for legibility.</p>
  
  <blockquote>
    <p>mod_wsgi (pid=5728, process='', application='192.168.20.11:8080|/myapp'): Loading WSGI script 'C:/wamp/www/myapp/myapp/wsgi.py'.</p>
    
    <p>mod_wsgi (pid=5728): Exception occurred processing WSGI script </p>
    
    <p>'C:/wamp/www/myapp/myapp/wsgi.py'.</p>
    
    <p>Traceback (most recent call last):</p>
    
    <p>File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 236, in <strong>call</strong></p>
    
    <p>self.load_middleware()</p>
    
    <p>for middleware_path in settings.MIDDLEWARE_CLASSES:</p>
    
    <p>File "C:\Python27\lib\site-packages\django\conf\_<em>init</em>_.py", line 52, in <strong>getattr</strong></p>
    
    <p>self._setup(name)</p>
    
    <p>File "C:\Python27\lib\site-packages\django\conf\_<em>init</em>_.py", line 47, in _setup</p>
    
    <p>self._wrapped = Settings(settings_module)</p>
    
    <p>File "C:\Python27\lib\site-packages\django\conf\_<em>init</em>_.py", line 132, in <strong>init</strong></p>
    
    <p>raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" %(self.SETTINGS_MODULE, e))</p>
    
    <p>ImportError: Could not import settings 'myapp.settings' (Is it on sys.path?): No module named myapp.settings</p>
    
    <p>File does not exist: C:/wamp/www/myapp/favicon.ico</p>
  </blockquote>
  
  <p>I don't understand the function of middleware in this case and was under the impression it wasn't necessary to use middleware.</p>
  
  <p>Regarding the system path, when I add:</p>
  
  <pre><code>WSGIPythonPath "c:/wamp/www/myapp"
  </code></pre>
  
  <p>to my VirtualHost in the httpd.conf file, the server refuses to start up. </p>
  
  <h2>Objective</h2>
  
  <p>To deploy a working Django app (that has been developed and tested locally using the Django development server) to a Microsoft SBS network without using IIS. I tried deploying on IIS and ran into difficulties early on so switched to WAMP. </p>
  
  <p>I'm new to Python and Django and have never deployed a web app on any production server (I am an R programmer that has generally used programming for math and statistics). </p>
  
  <p>Any advice that would help in achieving this objective, regardless of method, will be much appreciated!</p>