日期:2014-05-17  浏览次数:20688 次

Apache_python安装
Apache_python安装

安装环境:ubuntu server

1. apache,mod_python,python,安装
sudo apt-get install apache2 libapache2-mod-python python-mysqldb


a) Publisher Handler模式配置
编辑apache的虚拟主机,在你的<Directory /var/www>区域加入以下:
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug off


b) PSP Handler模式配置
编辑apache的虚拟主机,在你的<Directory /var/www>区域加入以下:
AddHandler mod_python .psp
PythonHandler mod_python.psp
PythonDebug off


以上两种模式都需要重启apache生效
sudo /etc/init.d/apache2 restart


2. 更好的选择mod-wsgi,但是需要你的应用程序支持
Ps:如果你安装了mod_python,需要先删除mod_python及其所有配置信息。
sudo apt-get install libapache2-mod-wsgi

对你的应用进行相应配置即可。

更多参考内容:
mod_python官方网站
mod_python中文参考手册
mod_wsgi项目首页
mod_wsgi文档中文翻译