2009-12-12 118 views
0

我試圖通過mod_python部署一個django項目,我不斷收到一個錯誤,指出處理程序模塊丟失。Django的mod_python部署錯誤

我的Apache配置:

<Location /> 
      SetHandler python-program 
      PythonHandler django.core.handlers.modpython 
      SetEnv DJANGO_SETTINGS_MODULE bookmarklet_server.settings 
      PythonOption django.root/
      PythonDebug On 
      #PythonPath "['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']" 
    </Location> 

另一條道路是從我試圖剛剛超過默認PYTHONPATH複製,但它並沒有幫助。

在Python控制檯快速測試顯示模塊應入店:

的Python 2.6.4(r264:75706,2009年11月2日,14點44分17秒) [GCC 4.4.1] on linux2 輸入「help」,「copyright」,「credits」或「license」以獲取更多信息。

>>>進口django.core.handlers.modpython

沒有錯誤

但是加載該網站,則inadvertendly返回此錯誤:

MOD_PYTHON ERROR 

ProcessId:  8926 
Interpreter: '<ip>' 

ServerName:  '<ip>' 
DocumentRoot: '/htdocs' 

URI:   '/' 
Location:  '/' 
Directory:  None 
Filename:  '/htdocs' 
PathInfo:  '/' 

Phase:   'PythonHandler' 
Handler:  'django.core.handlers.modpython' 

Traceback (most recent call last): 

    File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch 
    default=default_handler, arg=req, silent=hlist.silent) 

    File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1202, in  _process_target 
    module = import_module(module_name, path=path) 

    File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 304, in import_module 
    return __import__(module_name, {}, {}, ['*']) 

ImportError: No module named django.core.handlers.modpython 
+0

django中安裝了什麼路徑? Web服務器用戶可訪問嗎? – bobince 2009-12-12 11:33:38

回答

0

好的,設法解決這個問題。

這個特殊的進口問題已被修復安裝 django,而不是隻有svn樹幹鏈接到dist-packages。爲什麼這不適用於我不知道的服務器進程。

但無論如何,還有進一步的問題通過nginx進行CGI部署解決,最終導致最後一個問題(我的wsgi部署嘗試失敗)是我的/ home目錄是文件所在的位置只能由我自己訪問。

今天我學到了很多:)

0

也許django不在你的Pythonpath中?