我正在尝试让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
答案 0 :(得分:2)
很可能你的mod_wsgi是针对一个Python安装编译的,但是你试图强制它使用不同的Python安装。您遇到问题的原因是因为一个Python安装是使用UCS2支持而另一个是UCS4编译的。
在mod_wsgi.so上使用'ldd'来显示它尝试使用的Python安装,然后提供该信息作为问题的一部分以及mod_wsgi配置或WSGI脚本内容,您试图强制它使用不同的Python安装,或不兼容的虚拟环境。