我正在尝试通过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>
另一条路径来自我尝试复制默认的python路径,但它没有帮助。
python控制台中的快速测试显示该模块应该是可访问的:
Python 2.6.4(r264:75706,2009年11月2日,14:44:17) linux2上的[GCC 4.4.1] 输入“帮助”,“版权”,“信用”或“许可”以获取更多信息。
&GT;&GT;&GT; import 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
答案 0 :(得分:0)
也许django不在你的Pythonpath中?
答案 1 :(得分:0)
好的,设法解决问题。
此特定导入问题由安装 django修复,而不是仅将svn trunk链接到dist-packages。为什么这对我不知道的服务器进程不起作用。
但无论如何,通过nginx进行CGI部署解决了进一步的问题,最终问题(我的wsgi部署尝试也失败了)是我的/ home目录,这是文件的位置,是可访问的只有我自己。
我今天学到了很多东西:)