我試圖讓Django運行在Apache2.22上的mod_wsgi,但是我得到一個內部500錯誤。 我知道還有其他問題,但他們沒有我的具體錯誤。這是我回溯:由於Python問題,Django WSGI腳本不會加載
[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調用的問題。
我用「LDD」上mod_wsgi.so,得到了以下的輸出:
[email protected]# 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
作爲參考,'ldd'應該在Apache安裝中的mod_wsgi.so上運行。 IOW,給出一個完整的路徑或在同一個目錄中。請參閱http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library –
我在同一個目錄中。我正在採取這種反應,因爲mod_wsgi.so使用的是Python靜態庫而不是共享。 –
沒有這樣的事情。它說ldd在你所在的目錄中找不到名爲mod_wsgi.so的文件。如果它是靜態鏈接的,它仍然會生成輸出,但不會顯示對libpythonX.Y.so的依賴。 –