问题
I have a Django application using django-mssql to communicate w/ SQL Server.
This works just fine in the dev server (runserver) but under Apache/mod-wsgi, I get a fail related to it trying to find a .dll which does exist:
[Thu May 19 15:35:09 2011] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\win32\\lib\\pywintypes.py", line 98, in
__import_pywin32_system_module__ [Thu May 19 15:35:09 2011] [error] [client
127.0.0.1] raise ImportError("No system module '%s' (%s)" % (modname, filename)) [Thu May 19 15:35:09 2011] [error] [client 127.0.0.1] ImportError: No system module 'pywintypes' (pywintypes27.dll)
pywintypes27.dll exists in C:\Windows\SysWOW64 (64 bit windows, but I installed 32 bit py and Apache)
Is there something in either httpd.conf or WSGIScriptAlias I need to do/specify to help it find this dll? Something else I should do? I've done a fair bit of Googling/Binging/Searching to no avail.
Some further info: python27 (not Active State) pywin32 is installed Win Server 2008 (64 bit) Apache 2.2 Django 1.3
Thanks
回答1:
You mentioned that you have Apache 32bits and the official mod_wsgi site seems to only have win32 mod_wsgi binaries available, which in turn also require a 32 bits version of Python. From your description it is likely that you are using the pywin32 library for Windows 64 bits and you configuration expects the 32 bits one.
来源:https://stackoverflow.com/questions/6064243/django-mssql-not-working-in-apache-w-mod-wsgi-but-works-fine-in-dev-server