1. 安装wsgi
1.1 下载Source code
http://code.google.com/p/modwsgi/downloads/list
1.2 解压:
$ tar xvfz mod_wsgi-X.Y.tar.gz
1.3
$ ./configure
$ ./configure --with-apxs=/usr/local/apache/bin/apxs --with-python=/usr/local/bin/python
$ make
$ sudo make install
2. 载入模块。在httpd.conf中添加
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
3.创建wsgi script。保存为pyramid.wsgi
from pyramid.paster import get_app
application = get_app('/mnt/work/example/production.ini','main')
4.修改配置文件 /etc/apache2/sites-available/default
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /mnt/work/example
WSGIScriptAlias / /mnt/work/example/pyramid.wsgi
<Directory /mnt/work/example>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
5. 重启并运行
$ apachectl restart
--------------------------------------------------
Error:
打开浏览器看到Internal Error
查看日志
$ tail -f /var/log/apache2/error.log
发现有一句错误是:
"The EvalException middleware is not usable in a "
将pyramid.wsgi中的development.ini改成production.ini问题解决