顯示具有 wsgi 標籤的文章。 顯示所有文章
顯示具有 wsgi 標籤的文章。 顯示所有文章

2014年3月25日 星期二

mod_wsgi automatic reload on source code change

Adding the WSGIScriptReloading directive meant that any time I made changes to my application files, I could simply $  touch flaskTest.wsgi and the app would restart with changes applied.
 
# vi /etc/apache2/sites-enabled/000-default.conf 
<VirtualHost *:80>
    ServerName flasktest.subdimension.co.uk

    WSGIDaemonProcess flaskTest user=flask group=www-data threads=5 home=/<redacted>/flaskTest
    WSGIScriptAlias / /<redacted>/flaskTest/flaskTest.wsgi

    <Directory /<redacted>/flaskTest>
        WSGIProcessGroup flaskTest
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptReloading On
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

$ touch /<redacted>/flaskTest/flaskTest.wsgi




References :
Deploying Flask to Apache » subdimension

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