Skip to content
Myr

Added initial uwsgi deployment documentation for nginx; updated nginx URL in fastcgi deployment docs; added uwsgi to deployment index

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Merlin · committed by Ron DuPlain · parent 311c244 · Browse files · 3 files+65 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+65 added−1 removed

  • other:+65 added−1 removed

3 files+65 added−1 removed

modified:docs/deploying/fastcgi.rst+1 added-1 removed
146 unmodified lines
147 web server.148- different python interpreters being used.149150.. _lighttpd: http://www.lighttpd.net/151.. _nginx: http://nginx.net/151.. _nginx: http://nginx.org/152.. _flup: http://trac.saddi.com/flup
modified:docs/deploying/index.rst+1 added
14 unmodified lines
1516 mod_wsgi17 cgi18 fastcgi19 uwsgi20 others
added:docs/deploying/uwsgi.rst+63 added
1uWSGI2=====34A newly popular deployment method on servers like `cherokee`_ and `nginx`_5is uWSGI. To use your WSGI application with uWSGI protocol you will need6a uWSGI server first. uWSGI is both a protocol and an application server;7the application server can serve uWSGI, FastCGI, and HTTP protocols.89The most popular server is `uwsgi`_, which we will use for this guide.10Make sure to have it installed.1112.. admonition:: Watch Out1314 Please make sure in advance that your ``app.run()`` call you might15 have in your application file, is inside an ``if __name__ ==16 '__main__':`` or moved to a separate file. Just make sure it's not17 called because this will always start a local WSGI server which we do18 not want if we deploy that application to uWSGI.1920Starting your app with uwsgi21----------------------------2223`uwsgi` is designed to operate on WSGI callables found in python modules.2425Given a flask application in myapp.py, use the following command:2627.. sourcecode:: text2829 $ uwsgi -s /tmp/uwsgi.sock --module myapp --callable app3031Or, if you prefer:3233.. sourcecode:: text3435 $ uwsgi -s /tmp/uwsgi.sock myapp:app3637Configuring nginx38-----------------3940A basic flask uWSGI configuration for nginx looks like this::4142 location = /yourapplication { rewrite ^ /yourapplication/; }43 location /yourapplication { try_files $uri @yourapplication; }44 location @yourapplication {45 include uwsgi_params;46 uwsgi_param SCRIPT_NAME /yourapplication;47 uwsgi_modifier1 30;48 uwsgi_pass unix:/tmp/uwsgi.sock;49 }5051This configuration binds the application to `/yourapplication`. If you want52to have it in the URL root it's a bit simpler because you don't have to tell53it the WSGI `SCRIPT_NAME` or set the uwsgi modifer to make use of it::5455 location / { try_files $uri @yourapplication; }56 location @yourapplication {57 include uwsgi_params;58 uwsgi_pass unix:/tmp/uwsgi.sock;59 }6061.. _cherokee: http://www.cherokee-project.com/62.. _nginx: http://nginx.org/63.. _uwsgi: http://projects.unbit.it/uwsgi/