Skip to content
Myr

index.rst

This file

Path

docs/deploying/index.rst

79 lines · 3.1 KiB

Last changed by

Merge branch '2.2.x'David Lordbefore adoption73b9bac

History of this file

Take it

1Deploying to Production2=======================34After developing your application, you'll want to make it available5publicly to other users. When you're developing locally, you're probably6using the built-in development server, debugger, and reloader. These7should not be used in production. Instead, you should use a dedicated8WSGI server or hosting platform, some of which will be described here.910"Production" means "not development", which applies whether you're11serving your application publicly to millions of users or privately /12locally to a single user. **Do not use the development server when13deploying to production. It is intended for use only during local14development. It is not designed to be particularly secure, stable, or15efficient.**1617Self-Hosted Options18-------------------1920Flask is a WSGI *application*. A WSGI *server* is used to run the21application, converting incoming HTTP requests to the standard WSGI22environ, and converting outgoing WSGI responses to HTTP responses.2324The primary goal of these docs is to familiarize you with the concepts25involved in running a WSGI application using a production WSGI server26and HTTP server. There are many WSGI servers and HTTP servers, with many27configuration possibilities. The pages below discuss the most common28servers, and show the basics of running each one. The next section29discusses platforms that can manage this for you.3031.. toctree::32    :maxdepth: 13334    gunicorn35    waitress36    mod_wsgi37    uwsgi38    gevent39    eventlet40    asgi4142WSGI servers have HTTP servers built-in. However, a dedicated HTTP43server may be safer, more efficient, or more capable. Putting an HTTP44server in front of the WSGI server is called a "reverse proxy."4546.. toctree::47    :maxdepth: 14849    proxy_fix50    nginx51    apache-httpd5253This list is not exhaustive, and you should evaluate these and other54servers based on your application's needs. Different servers will have55different capabilities, configuration, and support.565758Hosting Platforms59-----------------6061There are many services available for hosting web applications without62needing to maintain your own server, networking, domain, etc. Some63services may have a free tier up to a certain time or bandwidth. Many of64these services use one of the WSGI servers described above, or a similar65interface. The links below are for some of the most common platforms,66which have instructions for Flask, WSGI, or Python.6768- `PythonAnywhere <https://help.pythonanywhere.com/pages/Flask/>`_69- `Google App Engine <https://cloud.google.com/appengine/docs/standard/python3/building-app>`_70- `Google Cloud Run <https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service>`_71- `AWS Elastic Beanstalk <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html>`_72- `Microsoft Azure <https://docs.microsoft.com/en-us/azure/app-service/quickstart-python>`_7374This list is not exhaustive, and you should evaluate these and other75services based on your application's needs. Different services will have76different capabilities, configuration, pricing, and support.7778You'll probably need to :doc:`proxy_fix` when using most hosting79platforms.