我试图让 Django 在 Apache2.22 上通过 mod_wsgi 运行,但出现内部 500 错误。我知道对此还有其他问题,但他们没有我的具体错误。这是我的回溯:
[Sat Jun 16 02:17:48 2012] [info] [client 128.227.11.143] mod_wsgi (pid=23071, process='partender', application='www.***.com|'): Loading WSGI script '/usr/home/***.com/zpencerq/part/apache/django.wsgi'.
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] mod_wsgi (pid=23071): Target WSGI script '/usr/home/***.com/zpencerq/part/apache/django.wsgi' cannot be loaded as Python module.
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] mod_wsgi (pid=23071): Exception occurred processing WSGI script '/usr/home/***.com/zpencerq/part/apache/django.wsgi'.
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] Traceback (most recent call last):
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] File "/usr/home/partender.myprotosite.com/zpencerq/part/apache/django.wsgi", line 9, in <module>
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] import django.core.handlers.wsgi
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 2, in <module>
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] from threading import Lock
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] File "/usr/local/lib/python2.7/threading.py", line 15, in <module>
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] from collections import deque
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] File "/usr/local/lib/python2.7/collections.py", line 9, in <module>
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] from operator import itemgetter as _itemgetter
[Sat Jun 16 02:17:48 2012] [error] [client 128.227.11.143] ImportError: /usr/local/lib/python2.7/lib-dynload/operator.so: Undefined symbol "_PyUnicodeUCS4_AsDefaultEncodedString"
这似乎是 python 的一个问题,但我不知道如何处理回溯中的最后一个错误。这是python安装的问题吗?我已经完成了简单的 WSGI hello world 应用程序,而且效果很好。这是 django 调用的问题。
我在 mod_wsgi.so 上使用了 'ldd' 并得到以下输出:
root@blah# ldd mod_wsgi.so
mod_wsgi.so:
ldd: mod_wsgi.so: Shared object "mod_wsgi.so" not found, required by "ldd"
mod_wsgi.so: exit status 1