title: Setting Python Path in Windows XAMPP using WSGI
body: <p>I'm setting up a development version of a live server on Webfaction, running Django apps in a virtual Apache server environment (running without any errors) on my local machine - XP, running XAMPP Lite with Python 2.6 - which I can commit changes from via Git.</p>
  
  <p>XAMPP is up and running OK with Python, and the server starts perfectly with WSGI module loaded. The problem is when I set my Python paths, they are set half in 'nix format (with /), and half in Windows (with backslashes).</p>
  
  <p>Here's the local machine Apache error, showing the corrupted python paths:</p>
  
  <pre><code>[Fri Oct 08 14:52:53 2010] [error] [client 127.0.0.1] mod_wsgi (pid=1436): Exception occurred processing WSGI script 'C:/SERVER/Python26/Lib/site-packages/website-cms/webapps/django/dev.wsgi'.
  [Fri Oct 08 14:52:53 2010] [error] [client 127.0.0.1] Traceback (most recent call last):
  [Fri Oct 08 14:52:53 2010] [error] [client 127.0.0.1]   File "C:/SERVER/Python26/Lib/site-packages/website-cms/webapps/django/lib/python2.5\\django\\core\\handlers\\wsgi.py", line 230, in __call__
  [Fri Oct 08 14:52:53 2010] [error] [client 127.0.0.1]     self.load_middleware()
  [Fri Oct 08 14:52:53 2010] [error] [client 127.0.0.1]   File "C:/SERVER/Python26/Lib/site-packages/website-cms/webapps/django/lib/python2.5\\django\\core\\handlers\\base.py", line 42, in load_middleware
  [Fri Oct 08 14:52:53 2010] [error] [client 127.0.0.1]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
  [Fri Oct 08 14:52:53 2010] [error] [client 127.0.0.1] ImproperlyConfigured: Error importing middleware cms.middleware.multilingual: "No module named cms.middleware.multilingual"
  </code></pre>
  
  <p>And the offending .wsgi file contents:</p>
  
  <pre><code>import os, sys
  
  sys.path.append('C:/SERVER/Python26/')
  sys.path.append('C:/SERVER/Python26/Lib/site-packages/website-cms/webapps/django')
  sys.path.append('C:/SERVER/Python26/Lib/site-packages/website-cms/webapps/django/lib/python2.5')
  
  from django.core.handlers.wsgi import WSGIHandler
  
  #Add the path to Django itself
  os.environ['DJANGO_SETTINGS_MODULE'] = 'website.settings'
  application = WSGIHandler()
  </code></pre>
  
  <p>The Apache httpd.conf is the default for XAMPP (and not a virtual instance), with the following added to load the wsgi module</p>
  
  <pre><code>LoadModule wsgi_module modules/mod_wsgi-win32-ap22py26-3.3.so
  </code></pre>
  
  <p>&amp; to point to the wsgi file:</p>
  
  <pre><code>WSGIScriptAlias / C:/SERVER/Python26/Lib/site-packages/website-cms/webapps/django/dev.wsgi
  </code></pre>
  
  <p>I know the XAMPP server is using Python2.6 (I'm forced to to use TortoiseGIT) and the production is on 2.5 (enfordced by the web host), but that doesn't seem to be the culprit - I would still expect to be able to set the correct path at least!</p>
  
  <p>All suggestions on getting the Python path to play ball welcomed!</p>