1. Installing the WSGI Apache module
Easy_install Mod_wsgi
2, add/etc/httpd/conf.d/wsgi.conf
LoadModule Wsgi_module modules/mod_wsgi.so
3, add or edit/etc/httpd/conf.d/virtualhosts.conf
My app is located in/home/www/wx/wx.srv
<virtualhost *:80>servername www.yourcompany.com#WSGIDaemonProcess wxsrv threads=5wsgiscriptalias/wxsrv /home/www/wx/wx.srv/wxsrv.wsgi<directory "/home/www/wx/wx.srv" > #WSGIProcessGroup wxsrvwsgiapplicationgroup Wx_srvdirectoryindex wxsrv.wsgiallowoverride Allorder Deny,allowallow from All</directory></virtualhost >
4, create/home/www/wx/wx.srv/wxsrv.wsgi
Import Siteimport sys,loggingsys.path.append ("/home/www/wx/wx.srv/"); Site.addsitedir ("/usr/lib/python2.6/ Site-packages ") from Wxsrv Import app as Applicationapplication.logger.setLevel (logging. DEBUG)
5. Restart Apache Service
Service httpd Restart
If successful, the application access path is
http://www.yourcompany.com/wxsrv/
CentOS 6.5 Python 2.6.6+flask deployed in WSGI mode under Apache 2.2.15