171 lines
No EOL
8.7 KiB
HTML
171 lines
No EOL
8.7 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="../">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Deploying to Production — Flask Documentation (3.2.x)</title>
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=6625fa76" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/flask.css?v=b87c8d14" />
|
||
<script src="../_static/documentation_options.js?v=56528222"></script>
|
||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<script data-project="flask" data-version="3.2.x" src="../_static/describe_version.js?v=fa7f30d0"></script>
|
||
<link rel="icon" href="../_static/shortcut-icon.png"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="Gunicorn" href="gunicorn.html" />
|
||
<link rel="prev" title="Security Considerations" href="../web-security.html" />
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="gunicorn.html" title="Gunicorn"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="../web-security.html" title="Security Considerations"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Flask Documentation (3.2.x)</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Deploying to Production</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="deploying-to-production">
|
||
<h1>Deploying to Production<a class="headerlink" href="#deploying-to-production" title="Link to this heading">¶</a></h1>
|
||
<p>After developing your application, you’ll want to make it available
|
||
publicly to other users. When you’re developing locally, you’re probably
|
||
using the built-in development server, debugger, and reloader. These
|
||
should not be used in production. Instead, you should use a dedicated
|
||
WSGI server or hosting platform, some of which will be described here.</p>
|
||
<p>“Production” means “not development”, which applies whether you’re
|
||
serving your application publicly to millions of users or privately /
|
||
locally to a single user. <strong>Do not use the development server when
|
||
deploying to production. It is intended for use only during local
|
||
development. It is not designed to be particularly secure, stable, or
|
||
efficient.</strong></p>
|
||
<section id="self-hosted-options">
|
||
<h2>Self-Hosted Options<a class="headerlink" href="#self-hosted-options" title="Link to this heading">¶</a></h2>
|
||
<p>Flask is a WSGI <em>application</em>. A WSGI <em>server</em> is used to run the
|
||
application, converting incoming HTTP requests to the standard WSGI
|
||
environ, and converting outgoing WSGI responses to HTTP responses.</p>
|
||
<p>The primary goal of these docs is to familiarize you with the concepts
|
||
involved in running a WSGI application using a production WSGI server
|
||
and HTTP server. There are many WSGI servers and HTTP servers, with many
|
||
configuration possibilities. The pages below discuss the most common
|
||
servers, and show the basics of running each one. The next section
|
||
discusses platforms that can manage this for you.</p>
|
||
<div class="toctree-wrapper compound">
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="gunicorn.html">Gunicorn</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="waitress.html">Waitress</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="mod_wsgi.html">mod_wsgi</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="uwsgi.html">uWSGI</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="gevent.html">gevent</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="eventlet.html">eventlet</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="asgi.html">ASGI</a></li>
|
||
</ul>
|
||
</div>
|
||
<p>WSGI servers have HTTP servers built-in. However, a dedicated HTTP
|
||
server may be safer, more efficient, or more capable. Putting an HTTP
|
||
server in front of the WSGI server is called a “reverse proxy.”</p>
|
||
<div class="toctree-wrapper compound">
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="proxy_fix.html">Tell Flask it is Behind a Proxy</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="nginx.html">nginx</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="apache-httpd.html">Apache httpd</a></li>
|
||
</ul>
|
||
</div>
|
||
<p>This list is not exhaustive, and you should evaluate these and other
|
||
servers based on your application’s needs. Different servers will have
|
||
different capabilities, configuration, and support.</p>
|
||
</section>
|
||
<section id="hosting-platforms">
|
||
<h2>Hosting Platforms<a class="headerlink" href="#hosting-platforms" title="Link to this heading">¶</a></h2>
|
||
<p>There are many services available for hosting web applications without
|
||
needing to maintain your own server, networking, domain, etc. Some
|
||
services may have a free tier up to a certain time or bandwidth. Many of
|
||
these services use one of the WSGI servers described above, or a similar
|
||
interface. The links below are for some of the most common platforms,
|
||
which have instructions for Flask, WSGI, or Python.</p>
|
||
<ul class="simple">
|
||
<li><p><a class="reference external" href="https://help.pythonanywhere.com/pages/Flask/">PythonAnywhere</a></p></li>
|
||
<li><p><a class="reference external" href="https://cloud.google.com/appengine/docs/standard/python3/building-app">Google App Engine</a></p></li>
|
||
<li><p><a class="reference external" href="https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service">Google Cloud Run</a></p></li>
|
||
<li><p><a class="reference external" href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html">AWS Elastic Beanstalk</a></p></li>
|
||
<li><p><a class="reference external" href="https://docs.microsoft.com/en-us/azure/app-service/quickstart-python">Microsoft Azure</a></p></li>
|
||
</ul>
|
||
<p>This list is not exhaustive, and you should evaluate these and other
|
||
services based on your application’s needs. Different services will have
|
||
different capabilities, configuration, pricing, and support.</p>
|
||
<p>You’ll probably need to <a class="reference internal" href="proxy_fix.html"><span class="doc">Tell Flask it is Behind a Proxy</span></a> when using most hosting
|
||
platforms.</p>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<span id="sidebar-top"></span>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper">
|
||
|
||
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/flask-vertical.png" alt="Logo of Flask"/>
|
||
</a></p>
|
||
|
||
|
||
<h3>Contents</h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Deploying to Production</a><ul>
|
||
<li><a class="reference internal" href="#self-hosted-options">Self-Hosted Options</a><ul>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#hosting-platforms">Hosting Platforms</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li><a href="../index.html">Overview</a>
|
||
<ul>
|
||
<li>Previous: <a href="../web-security.html" title="previous chapter">Security Considerations</a>
|
||
<li>Next: <a href="gunicorn.html" title="next chapter">Gunicorn</a>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<search id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</search>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script><div id="ethical-ad-placement"></div>
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2010 Pallets.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
|
||
</div>
|
||
</body>
|
||
</html> |