欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Mod python
来自开放百科 - 灰狐
(版本间的差异)
(未显示1个用户的4个中间版本) | |||
第1行: | 第1行: | ||
+ | {{top news}} | ||
+ | {{SeeWikipedia}} | ||
+ | |||
Apache/Python Integration | Apache/Python Integration | ||
第4行: | 第7行: | ||
==安装== | ==安装== | ||
Debian用户 | Debian用户 | ||
+ | #apt-get install libapache-mod-python-doc - An Apache module that embeds Python within the server | ||
+ | #apt-get install libapache-mod-python2.1 - An Apache module that embeds Python 2.1 within the server | ||
+ | #apt-get install libapache-mod-python2.2 - An Apache module that embeds Python 2.2 within the server | ||
+ | #apt-get install libapache-mod-python2.3 - An Apache module that embeds Python 2.3 within the server | ||
+ | #apt-get install libapache2-mod-python - An Apache module that embeds Python within the server | ||
+ | #apt-get install libapache2-mod-python-doc - An Apache module that embeds Python within the server | ||
+ | #apt-get install libapache2-mod-python2.2 - An Apache 2 module that embeds Python 2.2 within the server | ||
+ | #apt-get install libapache2-mod-python2.3 - An Apache 2 module that embeds Python 2.3 within the server | ||
− | + | Windows用户,建议不要使用,问题很多 | |
http://apache.justdn.org/httpd/modpython/win/3.3.1/mod_python-3.3.1.win32-py2.5-Apache2.2.exe | http://apache.justdn.org/httpd/modpython/win/3.3.1/mod_python-3.3.1.win32-py2.5-Apache2.2.exe | ||
会生成 C:\apache-2.2.3\modules\mod_python.so 文件 | 会生成 C:\apache-2.2.3\modules\mod_python.so 文件 | ||
第30行: | 第41行: | ||
*http://www.modpython.org/ | *http://www.modpython.org/ | ||
*http://apache.justdn.org/httpd/modpython/win/ | *http://apache.justdn.org/httpd/modpython/win/ | ||
− | * | + | *[http://wiki.woodpecker.org.cn/moin/modpythoncn mod_python中文文档] |
+ | |||
+ | [[Category:Apache]] | ||
+ | [[Category:Python]] |
2010年9月27日 (一) 06:44的最后版本
您可以在Wikipedia上了解到此条目的英文信息 Mod python Thanks, Wikipedia. |
Apache/Python Integration
mod_python是apache组织的一个项目,通过它,可以开发psp或cgi,mod_python功能强大,速度快,是非常优秀的web开发工具。
[编辑] 安装
Debian用户
#apt-get install libapache-mod-python-doc - An Apache module that embeds Python within the server #apt-get install libapache-mod-python2.1 - An Apache module that embeds Python 2.1 within the server #apt-get install libapache-mod-python2.2 - An Apache module that embeds Python 2.2 within the server #apt-get install libapache-mod-python2.3 - An Apache module that embeds Python 2.3 within the server #apt-get install libapache2-mod-python - An Apache module that embeds Python within the server #apt-get install libapache2-mod-python-doc - An Apache module that embeds Python within the server #apt-get install libapache2-mod-python2.2 - An Apache 2 module that embeds Python 2.2 within the server #apt-get install libapache2-mod-python2.3 - An Apache 2 module that embeds Python 2.3 within the server
Windows用户,建议不要使用,问题很多
http://apache.justdn.org/httpd/modpython/win/3.3.1/mod_python-3.3.1.win32-py2.5-Apache2.2.exe 会生成 C:\apache-2.2.3\modules\mod_python.so 文件 <Directory "C:/myweb/python/"> AddHandler mod_python .html PythonHandler mptest PythonDebug On </Directory> mptest.py from mod_python import apache def handler(req): req.content_type = 'text/plain' req.write("Hello World!") return apache.OK http://localhost/python/mptest.html :)
[编辑] 性能
mod_python 的一个最主要优点就是在性能上超越传统CGI。下面是一个非常粗略的测试。该测试是在一台运行Red Hat Linux 7.3的奔腾1.2G的机器上完成的。Ab 用来对4种脚本进行测试,所有的都是从标准cgi模块输入(因为这是一个典型Python cgi脚本开始的方式), 然后输出一个简单的单词"Hello!"。这个结果是基于10000次并发为1的请求。
Standard CGI: 23 requests/s Mod_python cgihandler: 385 requests/s Mod_python publisher: 476 requests/s Mod_python handler: 1203 requests/s
分享您的观点