Skip to content
Myr

added in example tornado and gevent usage for flask integration

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

authored by Justin Quick · committed by Armin Ronacher · parent 51c9829 · Browse files · 1 file+39 added−0 removed
This commit

State

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

Diff stats

1 file+39 added−0 removed

  • other:+39 added−0 removed

1 file+39 added−0 removed

modified:docs/deploying.rst+39 added
221 unmodified lines
222.. _virtual python: http://pypi.python.org/pypi/virtualenv223.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/224225226227Tornado228--------229230`Tornado`_ is an open source version of the scalable, non-blocking web server and tools that power `FriendFeed`_.231Because it is non-blocking and uses epoll, it can handle thousands of simultaneous standing connections, which means it is ideal for real-time web services.232Integrating this service with Flask is a trivial task::233234 235 from tornado.wsgi import WSGIContainer236 from tornado.httpserver import HTTPServer237 from tornado.ioloop import IOLoop238 from yourapplication import app239 240 http_server = HTTPServer(WSGIContainer(app))241 http_server.listen(5000)242 IOLoop.instance().start()243244245.. _Tornado: http://www.tornadoweb.org/246.. _FriendFeed: http://friendfeed.com/247248249Gevent250-------251252`Gevent`_ is a coroutine-based Python networking library that uses `greenlet`_ to provide a high-level synchronous API on top of `libevent`_ event loop::253254 from gevent.wsgi import WSGIServer255 from yourapplication import app256257 http_server = WSGIServer(('', 5000), app)258 http_server.serve_forever()259260.. _Gevent: http://www.gevent.org/261.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html262.. _libevent: http://monkey.org/~provos/libevent/263264CGI265---266267If all other deployment methods do not work, CGI will work for sure. CGI
34 unmodified lines
302303 ScriptName /app /path/to/the/application.cgi304305For more information consult the documentation of your webserver.306