Prerequsitation:
1.Apache v2.2.4
2.Python2.4
3.mod_python3.3.1 for apache2.2 and python2.4
Configure Steps:
1.Add below in the apache/conf/http.conf(first check the mod_python.so whether exists in apache/modelus)
LoadModule python_module modules/mod_python.so
2.Configure the http.conf,add below(Confirm that you have configured web root for c:\work\wwwroot):
Just like this:DocumentRoot "C:/Work/wwwroot"
<directory python="" wwwroot="" work=""></directory>/<directory python="" wwwroot="" work=""></directory>
AddHandler mod_python .py
#PythonHandler mptest
PythonHandler mod_python.publisher
PythonDebug On
/
3.Put down a py script(aaron.py) in C:/Work/wwwroot/python
from mod_python import apache
def handler(req):
req.content_type = 'text/plain'
req.write("Dynamic language python!")
return apache.OK
4.Visit the web by:
http://localhost/python/aaron.py/handler
see done or not
Appendix A Reference:
http://www.modpython.org/live/current/doc-html/inst-testing.html
配置Python与Apache
本文介绍如何在Apache 2.2.4环境下配置Python 2.4,并使用mod_python 3.3.1实现动态页面处理。主要内容包括安装必要的软件、配置Apache的http.conf文件以及创建并运行Python脚本来响应HTTP请求。
230

被折叠的 条评论
为什么被折叠?



