I have two django sites that use the same database and share some of the code. The main parent site is an extranet for staff and contractors, while the second site exposes s
Installing pywin32 #212 solved the problem.
I had this same problem (using Python 2.7, Django 1.4.1, Apache 2.2, mod_wsgi 3.3) and solved it by removing pywin32 (ver.217). Django tries to import from pywin32, but doesn't appear to require it. If you need pywin32 in your Django site, this is not the answer for you, but I just had it installed and wasn't using it.
EDIT: I was actually using virtualenv for my sites, but my main Python was leaking in. If you do need pywin32 in some things, then use virtualenv, and read this wiki page on mod_wsgi and virtual environments:
VirtualEnvironments - mod_wsgi
only adding quotes in httpd.conf (as suggested by kiran.gilvaz) was in my case enough to solve the problem. I did not remove pywin32 (pywin32 was version 218).
I ran into this on version 217, but I needed pywin32. Implementing fix from here https://stackoverflow.com/a/10928148/80516 seems to work.
Bug is reported, but not resolved:
https://sourceforge.net/tracker/?func=detail&aid=2905909&group_id=78018&atid=551954
Temporary solution is comment out two lines in win32/lib/pywintypes.py:
if sys.version_info < (3,0): #next two lines are problematic!!!!! #assert sys.modules[modname] is old_mod #assert mod is old_mod pass else: assert sys.modules[modname] is not old_mod assert sys.modules[modname] is mod # as above - re-reset to the *old* module object then update globs. sys.modules[modname] = old_mod globs.update(mod.__dict__)
It worked for me after removing pywin32 and using WSGIScriptAlias "/aliasname" "c:/wamp/www/project/django.wsgi" In httpd.config Use quotes for the first parameter also.