<h1>eventlet<aclass="headerlink"href="#eventlet"title="Link to this heading">¶</a></h1>
<p>Prefer using <aclass="reference internal"href="gunicorn.html"><spanclass="doc">Gunicorn</span></a> with eventlet workers rather than using
<aclass="reference external"href="https://eventlet.net/">eventlet</a> directly. Gunicorn provides a much more configurable and
production-tested server.</p>
<p><aclass="reference external"href="https://eventlet.net/">eventlet</a> allows writing asynchronous, coroutine-based code that looks
like standard synchronous Python. It uses <aclass="reference external"href="https://greenlet.readthedocs.io/en/latest/">greenlet</a> to enable task
switching without writing <codeclass="docutils literal notranslate"><spanclass="pre">async/await</span></code> or using <codeclass="docutils literal notranslate"><spanclass="pre">asyncio</span></code>.</p>
<p><aclass="reference internal"href="gevent.html"><spanclass="doc">gevent</span></a> is another library that does the same thing. Certain
dependencies you have, or other considerations, may affect which of the
two you choose to use.</p>
<p>eventlet provides a WSGI server that can handle many connections at once
instead of one per worker process. You must actually use eventlet in
your own code to see any benefit to using the server.</p>
<sectionid="installing">
<h2>Installing<aclass="headerlink"href="#installing"title="Link to this heading">¶</a></h2>
<p>When using eventlet, greenlet>=1.0 is required, otherwise context locals
such as <codeclass="docutils literal notranslate"><spanclass="pre">request</span></code> will not work as expected. When using PyPy,
PyPy>=7.3.7 is required.</p>
<p>Create a virtualenv, install your application, then install
<divclass="code-block-caption"><spanclass="caption-text"><codeclass="docutils literal notranslate"><spanclass="pre">wsgi.py</span></code></span><aclass="headerlink"href="#id2"title="Link to this code">¶</a></div>
<h2>Binding Externally<aclass="headerlink"href="#binding-externally"title="Link to this heading">¶</a></h2>
<p>eventlet should not be run as root because it would cause your
application code to run as root, which is not secure. However, this
means it will not be possible to bind to port 80 or 443. Instead, a
reverse proxy such as <aclass="reference internal"href="nginx.html"><spanclass="doc">nginx</span></a> or <aclass="reference internal"href="apache-httpd.html"><spanclass="doc">Apache httpd</span></a> should be used
in front of eventlet.</p>
<p>You can bind to all external IPs on a non-privileged port by using
<codeclass="docutils literal notranslate"><spanclass="pre">0.0.0.0</span></code> in the server arguments shown in the previous section.
Don’t do this when using a reverse proxy setup, otherwise it will be
possible to bypass the proxy.</p>
<p><codeclass="docutils literal notranslate"><spanclass="pre">0.0.0.0</span></code> is not a valid address to navigate to, you’d use a specific