2014年2月23日 星期日

Flask with Apache and mod_wsgi

Debian / Ubuntu:
# apt-get install python-setuptools
# easy_install pip
# cd /var/www
# git clone https://github.com/salimane/flask-mvc.git
# cd flask-mvc
# pip install -r requirements.txt
# vi application.wsgi
import sys                                                                                                         
sys.path.insert(0,'/var/www/flask-mvc')
from project import app as application
# apt-get install libapache2-mod-wsgi
# vi /etc/apache2/sites-enabled/000-default.conf
        WSGIDaemonProcess flaskapp user=www-data group=www-data threads=5
        WSGIScriptAlias /flask-mvc /var/www/flask-mvc/application.wsgi

       
                WSGIProcessGroup flaskapp
                WSGIApplicationGroup %{GLOBAL}
                Order deny,allow
                Allow from all
       
# /etc/init.d/apache2 restart

http://0.0.0.0/flask-mvc


CentOS :

# yum install python-setuptools
# easy_install pip
# cd /var/www/html
# git clone https://github.com/salimane/flask-mvc.git
# cd flask-mvc
# pip install -r requirements.txt
# vi application.wsgi
import sys
sys.path.insert(0,'/var/www/html/flask-mvc')
from project import app as application
# yum install mod_wsgi
# vi /etc/httpd/conf/httpd.conf
WSGIDaemonProcess flaskapp user=www-data group=www-data threads=5
WSGISocketPrefix run/wsgi
WSGIScriptAlias /flask-mvc /var/www/html/flask-mvc/application.wsgi

    WSGIProcessGroup flaskapp
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
# /etc/init.d/httpd restart




References :
mod_wsgi (Apache) — Flask 0.11-dev documentation
Deploying Flask Apps with Apache and Mod WSGI - Informatics Bridging Team - Ocean Imaging Informatics @ WHOI

沒有留言:

張貼留言