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/
时间: 2024-10-16 23:34:03