Multiple django sites on Apache / Windows / mod_wsgi - problem with win32

无人久伴 提交于 2019-11-29 10:26:48

Installing pywin32 #212 solved the problem.

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.

wes

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__)

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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!