forked from orbit-oss/flask
Reorder deployment options.
This commit is contained in:
parent
7e4b705b3c
commit
976c9576bd
4 changed files with 40 additions and 39 deletions
|
|
@ -3,12 +3,11 @@
|
||||||
FastCGI
|
FastCGI
|
||||||
=======
|
=======
|
||||||
|
|
||||||
FastCGI is a deployment option on servers like `nginx`_, `lighttpd`_,
|
FastCGI is a deployment option on servers like `nginx`_, `lighttpd`_, and
|
||||||
and `cherokee`_; see :ref:`deploying-uwsgi` and
|
`cherokee`_; see :ref:`deploying-uwsgi` and :ref:`deploying-wsgi-standalone`
|
||||||
:ref:`deploying-other-servers` for other options. To use your WSGI
|
for other options. To use your WSGI application with any of them you will need
|
||||||
application with any of them you will need a FastCGI server first. The
|
a FastCGI server first. The most popular one is `flup`_ which we will use for
|
||||||
most popular one is `flup`_ which we will use for this guide. Make sure
|
this guide. Make sure to have it installed to follow along.
|
||||||
to have it installed to follow along.
|
|
||||||
|
|
||||||
.. admonition:: Watch Out
|
.. admonition:: Watch Out
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ For hosted options to get up and running quickly, see
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
mod_wsgi
|
mod_wsgi
|
||||||
cgi
|
wsgi-standalone
|
||||||
fastcgi
|
|
||||||
uwsgi
|
uwsgi
|
||||||
others
|
fastcgi
|
||||||
|
cgi
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,10 @@ uWSGI
|
||||||
=====
|
=====
|
||||||
|
|
||||||
uWSGI is a deployment option on servers like `nginx`_, `lighttpd`_, and
|
uWSGI is a deployment option on servers like `nginx`_, `lighttpd`_, and
|
||||||
`cherokee`_; see :ref:`deploying-fastcgi` and
|
`cherokee`_; see :ref:`deploying-fastcgi` and :ref:`deploying-wsgi-standalone`
|
||||||
:ref:`deploying-other-servers` for other options. To use your WSGI
|
for other options. To use your WSGI application with uWSGI protocol you will
|
||||||
application with uWSGI protocol you will need a uWSGI server
|
need a uWSGI server first. uWSGI is both a protocol and an application server;
|
||||||
first. uWSGI is both a protocol and an application server; the
|
the application server can serve uWSGI, FastCGI, and HTTP protocols.
|
||||||
application server can serve uWSGI, FastCGI, and HTTP protocols.
|
|
||||||
|
|
||||||
The most popular uWSGI server is `uwsgi`_, which we will use for this
|
The most popular uWSGI server is `uwsgi`_, which we will use for this
|
||||||
guide. Make sure to have it installed to follow along.
|
guide. Make sure to have it installed to follow along.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,31 @@
|
||||||
.. _deploying-other-servers:
|
.. _deploying-wsgi-standalone:
|
||||||
|
|
||||||
Other Servers
|
Standalone WSGI Containers
|
||||||
=============
|
==========================
|
||||||
|
|
||||||
There are popular servers written in Python that allow the execution of WSGI
|
There are popular servers written in Python that contain WSGI applications and
|
||||||
applications as well. These servers stand alone when they run; you can proxy
|
serve HTTP. These servers stand alone when they run; you can proxy to them
|
||||||
to them from your web server.
|
from your web server. Note the section on :ref:`deploying-proxy-setups` if you
|
||||||
|
run into issues.
|
||||||
|
|
||||||
|
Gunicorn
|
||||||
|
--------
|
||||||
|
|
||||||
|
`Gunicorn`_ 'Green Unicorn' is a WSGI HTTP Server for UNIX. It's a pre-fork
|
||||||
|
worker model ported from Ruby's Unicorn project. It supports both `eventlet`_
|
||||||
|
and `greenlet`_. Running a Flask application on this server is quite simple::
|
||||||
|
|
||||||
|
gunicorn myproject:app
|
||||||
|
|
||||||
|
`Gunicorn`_ provides many command-line options -- see ``gunicorn -h``.
|
||||||
|
For example, to run a Flask application with 4 worker processes (``-w
|
||||||
|
4``) binding to localhost port 4000 (``-b 127.0.0.1:4000``)::
|
||||||
|
|
||||||
|
gunicorn -w 4 -b 127.0.0.1:4000 myproject:app
|
||||||
|
|
||||||
|
.. _Gunicorn: http://gunicorn.org/
|
||||||
|
.. _eventlet: http://eventlet.net/
|
||||||
|
.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html
|
||||||
|
|
||||||
Tornado
|
Tornado
|
||||||
--------
|
--------
|
||||||
|
|
@ -14,7 +34,7 @@ Tornado
|
||||||
server and tools that power `FriendFeed`_. Because it is non-blocking and
|
server and tools that power `FriendFeed`_. Because it is non-blocking and
|
||||||
uses epoll, it can handle thousands of simultaneous standing connections,
|
uses epoll, it can handle thousands of simultaneous standing connections,
|
||||||
which means it is ideal for real-time web services. Integrating this
|
which means it is ideal for real-time web services. Integrating this
|
||||||
service with Flask is a trivial task::
|
service with Flask is straightforward::
|
||||||
|
|
||||||
from tornado.wsgi import WSGIContainer
|
from tornado.wsgi import WSGIContainer
|
||||||
from tornado.httpserver import HTTPServer
|
from tornado.httpserver import HTTPServer
|
||||||
|
|
@ -46,24 +66,7 @@ event loop::
|
||||||
.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html
|
.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html
|
||||||
.. _libevent: http://monkey.org/~provos/libevent/
|
.. _libevent: http://monkey.org/~provos/libevent/
|
||||||
|
|
||||||
Gunicorn
|
.. _deploying-proxy-setups:
|
||||||
--------
|
|
||||||
|
|
||||||
`Gunicorn`_ 'Green Unicorn' is a WSGI HTTP Server for UNIX. It's a pre-fork
|
|
||||||
worker model ported from Ruby's Unicorn project. It supports both `eventlet`_
|
|
||||||
and `greenlet`_. Running a Flask application on this server is quite simple::
|
|
||||||
|
|
||||||
gunicorn myproject:app
|
|
||||||
|
|
||||||
`Gunicorn`_ provides many command-line options -- see ``gunicorn -h``.
|
|
||||||
For example, to run a Flask application with 4 worker processes (``-w
|
|
||||||
4``) binding to localhost port 4000 (``-b 127.0.0.1:4000``)::
|
|
||||||
|
|
||||||
gunicorn -w 4 -b 127.0.0.1:4000 myproject:app
|
|
||||||
|
|
||||||
.. _Gunicorn: http://gunicorn.org/
|
|
||||||
.. _eventlet: http://eventlet.net/
|
|
||||||
.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html
|
|
||||||
|
|
||||||
Proxy Setups
|
Proxy Setups
|
||||||
------------
|
------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue