【发布时间】:2009-12-12 10:38:55
【问题描述】:
我正在尝试通过 mod_python 部署 django 项目,但一直收到错误消息,提示缺少处理程序模块。
我的 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] 在 linux2 上 输入“help”、“copyright”、“credits”或“license”了解更多信息。
>>> 导入 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
【问题讨论】:
-
django安装在什么路径下? Web 服务器用户可以访问它吗?
标签: django deployment mod-python