Skip to content
Myr

index.rst

This file

Path

docs/deploying/index.rst

80 lines · 3.2 KiB

Last changed by

Merge branch '2.1.x'David Lordbefore adoption9139af1

History of this file

Take it

The walk stopped after 200 commits: lines older than 8ad9b41 point at it.

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 1–2why, one step back
1Deploying to Production
2=======================

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 3why, one step back
3

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 4–8why, one step back
4After developing your application, you'll want to make it available
5publicly 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.

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 9why, one step back
9

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 10–15why, one step back
10"Production" means "not development", which applies whether you're
11serving 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.**

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 16why, one step back
16

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 17–18why, one step back
17Self-Hosted Options
18-------------------

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 19why, one step back
19

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 20–22why, one step back
20Flask is a WSGI *application*. A WSGI *server* is used to run the
21application, converting incoming HTTP requests to the standard WSGI22environ, and converting outgoing WSGI responses to HTTP responses.

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 23why, one step back
23

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 24–29why, one step back
24The primary goal of these docs is to familiarize you with the concepts
25involved 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.

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 30why, one step back
30

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 31–32why, one step back
31.. toctree::
32 :maxdepth: 1

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 33why, one step back
33

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 34–45why, one step back
34 gunicorn
35 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."45

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 46why, one step back
46.. toctree::

Merge branch '2.1.x'David Lordbefore adoption9139af1

line 47why, one step back
47 :maxdepth: 1

Merge pull request #3814 from lielfr/jsonencoder_html_testDavid Lordbefore adoption8ad9b41

line 48why, one step back
48

Merge branch '2.1.x'David Lordbefore adoption9139af1

lines 49–80why, one step back
49 proxy_fix
50 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- `Heroku <https://devcenter.heroku.com/articles/getting-started-with-python>`_70- `Google App Engine <https://cloud.google.com/appengine/docs/standard/python3/building-app>`_71- `Google Cloud Run <https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service>`_72- `AWS Elastic Beanstalk <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html>`_73- `Microsoft Azure <https://docs.microsoft.com/en-us/azure/app-service/quickstart-python>`_7475This list is not exhaustive, and you should evaluate these and other76services based on your application's needs. Different services will have77different capabilities, configuration, pricing, and support.7879You'll probably need to :doc:`proxy_fix` when using most hosting80platforms.