版本 apache2.2 python 2.5.1 mod_python 3.3.1()
下载mod_python安装文件,安装后配置apache中 http.conf文件
(我的py文件存放目录是c:/pysys)
加载如下内容:
Alias /py c:/pysys/
Allow from all
AddHandler mod_python .prog
SetHandler mod_python
PythonHandler test
PythonDebug On
Order allow,deny
Deny from all
建立一个测试文件:
# mod_python test example - test.py
from mod_python import apache
from sys import version
def writeinfo(req,name,value):
req.write("%s%s\n" % (name,value))
def handler(req):
req.content_type = "text/html"
if req.header_only:
return apache.OK
req.write("""mod_python is work
mod_python is working
You have successfully configutred mod_python on your Apache system.
Here is some information about the environment and this request:
" "")
writeinfo(req,"Client IP",req.get_remote_host(apache.REMOTE_NOLOOKUP))
writeinfo(req,"URI",req.uri)
writeinfo(req,"Filename",req.filename)
writeinfo(req,"Canonical filename",req.canonical_filename)
writeinfo(req,"Path_info",req.path_info)
writeinfo(req,"Python version",version)
req.write("
\n")
return apache.OK
|
输入
阅读(3363) | 评论(0) | 转发(0) |