Deploying to Production

After developing your application, you’ll want to make it availablepublicly to other users. When you’re developing locally, you’re probablyusing the built-in development server, debugger, and reloader. Theseshould not be used in production. Instead, you should use a dedicatedWSGI server or hosting platform, some of which will be described here.

“Production” means “not development”, which applies whether you’reserving your application publicly to millions of users or privately /locally to a single user.Do not use the development server whendeploying to production. It is intended for use only during localdevelopment. It is not designed to be particularly secure, stable, orefficient.

Self-Hosted Options

Flask is a WSGIapplication. A WSGIserver is used to run theapplication, converting incoming HTTP requests to the standard WSGIenviron, and converting outgoing WSGI responses to HTTP responses.

The primary goal of these docs is to familiarize you with the conceptsinvolved in running a WSGI application using a production WSGI serverand HTTP server. There are many WSGI servers and HTTP servers, with manyconfiguration possibilities. The pages below discuss the most commonservers, and show the basics of running each one. The next sectiondiscusses platforms that can manage this for you.

WSGI servers have HTTP servers built-in. However, a dedicated HTTPserver may be safer, more efficient, or more capable. Putting an HTTPserver in front of the WSGI server is called a “reverse proxy.”

This list is not exhaustive, and you should evaluate these and otherservers based on your application’s needs. Different servers will havedifferent capabilities, configuration, and support.

Hosting Platforms

There are many services available for hosting web applications withoutneeding to maintain your own server, networking, domain, etc. Someservices may have a free tier up to a certain time or bandwidth. Many ofthese services use one of the WSGI servers described above, or a similarinterface. The links below are for some of the most common platforms,which have instructions for Flask, WSGI, or Python.

This list is not exhaustive, and you should evaluate these and otherservices based on your application’s needs. Different services will havedifferent capabilities, configuration, pricing, and support.

You’ll probably need toTell Flask it is Behind a Proxy when using most hostingplatforms.