安装mod python时,出现如下错误.请各位帮帮忙...谢谢 

cuidenghong123 2011-06-29 09:56:04
软件版本:
python-2.6.msi
mod_python-3.3.1.win32-py2.6-apache2.2.exe
apache_2.2.14-win32-x86-no_ssl.msi

httpd.conf配置:
<Directory "D:/website/python">
AddHandler mod_python .py
PythonHandler fetchpage
PythonDebug On
PythonPath "sys.path+['D:\\website\\python']"
#这里是网上找到解决方案说需要加上 PyahonPath
</Directory>

在modules 目录下也有mod_python.so这个文件
在python中也发现加载到了 mod_python 这个包


运行时提示错误:


MOD_PYTHON ERROR

ProcessId: 3232
Interpreter: '10.8.8.246'

ServerName: '10.8.8.246'
DocumentRoot: 'D:/website'

URI: '/python/fetchpage.py'
Location: None
Directory: 'D:/website/python/'
Filename: 'D:/website/python/fetchpage.py'
PathInfo: ''

Phase: 'PythonHandler'
Handler: 'fetchpage'

Traceback (most recent call last):

File "D:\Python26\lib\site-packages\mod_python\importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

File "D:\Python26\lib\site-packages\mod_python\importer.py", line 1206, in _process_target
object = apache.resolve_object(module, object_str, arg, silent=silent)

File "D:\Python26\lib\site-packages\mod_python\apache.py", line 696, in resolve_object
raise AttributeError, s

AttributeError: module 'D:\website\python\fetchpage.py' contains no 'handler'


MODULE CACHE DETAILS

Accessed: Wed Jun 29 09:40:42 2011
Generation: 0

_mp_724a9517053291670d8bf23f2cc9d994 {
FileName: 'D:\\website\\python\\fetchpage.py'
Instance: 1 [IMPORT]
Generation: 1
Modified: Tue Jun 28 15:43:56 2011
Imported: Wed Jun 29 09:40:42 2011
}

最开始安装的是
软件版本:
python-2.5.msi
mod_python-3.3.1.win32-py2.5-apache2.2.exe
apache_2.2.14-win32-x86-no_ssl.msi

发现不行,然后换现在的版本还是不行。

在网上搜索了很多信息,发现很多人也有过类似的问题,也很多人都一次安装成功。

谁能帮忙解决下,感激不尽。
...全文
576 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jeky_zhang2013 2014-03-02
  • 打赏
  • 举报
回复
应该还需要配置python wsgi接口吧
不好说 2014-02-28
  • 打赏
  • 举报
回复
我也遇到这个问题了,顶一下!
yi599017330 2012-02-22
  • 打赏
  • 举报
回复
问一下这个问题你是怎么解决的
cuidenghong123 2011-06-30
  • 打赏
  • 举报
回复
自己顶下。
cuidenghong123 2011-06-29
  • 打赏
  • 举报
回复
回楼上的:
fetchpage.py

from mod_python import apache
def handler(req):
req.content_type = 'text/plain'

req.write("Hello World!\n")
return apache.OK



这个是fetchpage.py的代码
现在可以正常 输出了

但是 如果我建立了一个其他的文件 如test.py 输出其他的内容 但是还是指向的 fetchpage.py

PythonHandler fetchpage
这个是指.py结尾的都交给 fetchpage.py来处理是吧

现在我应该怎么修改了?
看到有的说修改成 PythonHandler mod_python.publisher
但是我一修改 就提示
Not Found

The requested URL /python/index.py was not found on this server.




iambic 2011-06-29
  • 打赏
  • 举报
回复
按照出错信息的字面意思,你的fetchpage.py是怎么写的?里面有提供一个handler吗?
cuidenghong123 2011-06-29
  • 打赏
  • 举报
回复
Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] mod_python (pid=3232, interpreter='10.8.8.246', phase='PythonHandler', handler='fetchpage'): Application error
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] ServerName: '10.8.8.246'
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] DocumentRoot: 'D:/website'
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] URI: '/python/fetchpage.py'
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] Location: None
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] Directory: 'D:/website/python/'
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] Filename: 'D:/website/python/fetchpage.py'
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] PathInfo: ''
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] File "D:\\Python26\\lib\\site-packages\\mod_python\\importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent)
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] File "D:\\Python26\\lib\\site-packages\\mod_python\\importer.py", line 1206, in _process_target\n object = apache.resolve_object(module, object_str, arg, silent=silent)
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] File "D:\\Python26\\lib\\site-packages\\mod_python\\apache.py", line 696, in resolve_object\n raise AttributeError, s
[Wed Jun 29 10:00:33 2011] [error] [client 127.0.0.1] AttributeError: module 'D:\\website\\python\\fetchpage.py' contains no 'handler'


这是apache的 错误日志

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧