|
|
|
|
| Debian 下安装Apache + mod_python 问题 |
 Debian 下安装Apache + mod_python 问题 - cnsclsyangbo [ 2006-04-01 21:59 | 1,396 byte(s)]
 Re: Debian 下安装Apache + mod_python 问题 - limodou [ 2006-04-01 22:35 | 92 byte(s)]
 Re: Debian 下安装Apache + mod_python 问题 - cnsclsyangbo [ 2006-04-01 23:43 | 663 byte(s)]
 Re: Debian 下安装Apache + mod_python 问题 - cnsclsyangbo [ 2006-04-02 00:00 | 243 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
环境:Debian 3.1 + Apache1.3 + Python2.3 + libapache-mod-python2.3
安装方式:
1、apache 是先安装好的。。 命令: apt-get install apache
2、安装python 命令:apt-get install python2.3 libapache-mod-python2.3
3、配置apache /etc/apache/httpd.conf
加入:
<Directory /internet/www/python>
AllowOverride All
Options +ExecCGI
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
Order allow,deny
Allow from all
</Directory>
4、在 /internet/www/python目录下建立mptest.py,内容如下:
from mod_python import apache
import sys
def test(req):
req.write("mod_python正常运行!")
=====================================================
5、问题现象:
源码原样显示了出来。。 真TMD的晕。。
from mod_python import apache
import sys
def test(req):
req.write("mod_python正常运行!")
我狂晕。。
AddHandler mod_python .py 好像没有作用哦?
不知是哪儿没对,请各位赐教!
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
谢谢楼上的兄弟。。。
现在好像py已经编译了。。 可是出现这样的低级错误
Mod_python error: "PythonHandler mptest"
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 185, in Dispatch
object = resolve_object(req, module, object_str, silent)
File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 394, in resolve_object
raise AttributeError, s
AttributeError: module '/internet/www/lsst.gov.cn/python/mptest.py' contains no 'handler'
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
问题已解决!
代码错误;;''
from mod_python import apache
def handler(req):
req.write("Hello World!")
return apache.OK
就正确了。。
|
|
|
[Original]
[Print]
[Top]
|
|
|