Diferencia entre revisiones de «Usuario:Lmorillas/desarrollo web servidor/flask/despliegue»
De WikiEducator
Línea 42: | Línea 42: | ||
==== virtual host en apache ==== | ==== virtual host en apache ==== | ||
<source lang="apache"> | <source lang="apache"> | ||
− | <VirtualHost *> | + | <VirtualHost *:80> |
ServerName example.com | ServerName example.com | ||
− | WSGIDaemonProcess yourapplication user=user1 group=group1 threads=5 | + | WSGIDaemonProcess yourapplication user=user1 group=group1 threads=5 home=/var/wwww/home ... |
WSGIScriptAlias / /var/www/yourapplication/lanzador.wsgi | WSGIScriptAlias / /var/www/yourapplication/lanzador.wsgi | ||
Línea 51: | Línea 51: | ||
WSGIProcessGroup yourapplication | WSGIProcessGroup yourapplication | ||
WSGIApplicationGroup %{GLOBAL} | WSGIApplicationGroup %{GLOBAL} | ||
+ | WSGIScriptReloading On | ||
Order deny,allow | Order deny,allow | ||
Allow from all | Allow from all | ||
Línea 73: | Línea 74: | ||
</Directory> | </Directory> | ||
</source> | </source> | ||
+ | |||
+ | |||
+ | ==== https ?? ==== | ||
+ | * http://www.subdimension.co.uk/2012/11/10/flask_modwsgi_ssl_oh_my.html | ||
+ | * http://flask.pocoo.org/snippets/93/ | ||
+ | * http://stackoverflow.com/questions/4893432/ssl-on-apache2-with-wsgi | ||
+ | |||
Revisión de 05:15 12 dic 2013
Apache con WSGI
Documentación
* http://flask.pocoo.org/docs/deploying/mod_wsgi/ |
Pasos
Instalar mod-wsgi
$ sudo apt-get update $ sudo apt-get install libapache2-mod-wsgi
Configurar usuario
$ useradd -M flask $ usermod -s /bin/false flask $ usermod -L flask $ adduser flask www-data
lanzador.wsgi
# Si usamos virtualenv activate_this = '/ruta/al/env/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) # Si no está instalada la app: para poder importar import sys sys.path.insert(0, '/ruta/a/la/aplicacion') from <miaplicacion> import app as application
- Tiene que tener permisos de ejecución
$ chmod +x lanzador.wsgi
virtual host en apache
<VirtualHost *:80> ServerName example.com WSGIDaemonProcess yourapplication user=user1 group=group1 threads=5 home=/var/wwww/home ... WSGIScriptAlias / /var/www/yourapplication/lanzador.wsgi <Directory /var/www/yourapplication> WSGIProcessGroup yourapplication WSGIApplicationGroup %{GLOBAL} WSGIScriptReloading On Order deny,allow Allow from all </Directory> </VirtualHost>
$ sudo a2ensite nuevo_sitio $ sudo service apache2 restart | reload
Si hay errores ...
$ tail -f /var/log/apache/error.log
con userdir
<Directory /home/*/public_html> Options Indexes FollowSymLinks MultiViews ExecCGI AddHandler wsgi-script .wsgi Order allow,deny Allow from all </Directory>
https ??
- http://www.subdimension.co.uk/2012/11/10/flask_modwsgi_ssl_oh_my.html
- http://flask.pocoo.org/snippets/93/
- http://stackoverflow.com/questions/4893432/ssl-on-apache2-with-wsgi