我正在尝试通过 mod_python 部署一个 django 项目,但我不断收到错误消息,提示缺少处理程序模块。
我的阿帕奇配置:
<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 控制台中的快速测试显示该模块应该是可访问的:
linux2 上的 Python 2.6.4 (r264:75706, Nov 2 2009, 14:44:17) [GCC 4.4.1] 键入“帮助”、“版权”、“信用”或“许可”以获取更多信息。
>>> 导入 django.core.handlers.modpython
没有错误
但是加载站点时,会无意中返回此错误:
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