CentOS 6.5 Python 2.6.6+Flask 用wsgi方式部署在Apache 2.2.15下

1,安装wsgi Apache模块

easy_install mod_wsgi

 

2,添加/etc/httpd/conf.d/wsgi.conf

LoadModule wsgi_module modules/mod_wsgi.so

 

3,添加或编辑/etc/httpd/conf.d/virtualhosts.conf

我的应用位于/home/www/wx/wx.srv

<VirtualHost *:80>
ServerName www.yourcompany.com
#WSGIDaemonProcess wxsrv  threads=5
WSGIScriptAlias /wxsrv /home/www/wx/wx.srv/wxsrv.wsgi
<Directory "/home/www/wx/wx.srv">
#WSGIProcessGroup wxsrv
WSGIApplicationGroup wx_srv
DirectoryIndex wxsrv.wsgi
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

 

4,创建/home/www/wx/wx.srv/wxsrv.wsgi

import site
import sys,logging
sys.path.append("/home/www/wx/wx.srv/");
site.addsitedir("/usr/lib/python2.6/site-packages");
from wxsrv import app as application
application.logger.setLevel(logging.DEBUG)

5,重新启动apache服务

service httpd restart

 成功的话,应用访问路径为

http://www.yourcompany.com/wxsrv/

 

posted @ 2015-09-02 09:57  柒零壹  阅读(1166)  评论(0编辑  收藏  举报