本番環境への展開(Deployment to Production) Deploying to Production

自分のアプリケーションを開発した後、他の人に対して公に利用可能にしたいと思うでしょう。ローカルで開発しているときは、おそらく組み込みの開発サーバ、デバッガ、reloaderを使っているでしょう。これらは、本番環境では使うべきではありません。代わりに、専用のWSGIサーバかホスティング・プラットフォーム(訳注: いわゆるホスティング・サービス、事業者がWSGIアプリを実行できるサーバなど(プラットフォーム)を用意し、ユーザがアプリをデプロイして利用します)を使用するべきであり、そのいくつかはここで説明していきます。 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.

「本番環境」は「開発ではない」ことを意味し、自分のアプリケーションを何百万ものユーザに対し公に提供しているものでも、またはプライベートに/ローカルに一人のユーザに対してのものでも当てはまります。本番環境へ展開(deploy)するときは、開発サーバは使わないでください。それはローカルでの開発の間だけ使うために意図されたものです。それは効率性、安定性、セキュリティを特別意識して設計されてはいません "Production" means "not development", which applies whether you're serving your application publicly to millions of users or privately / locally to a single user. **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.**

自分のサーバでホストするときの選択肢(Self-Hosted Options) Self-Hosted Options

FlaskはWSGIのアプリケーションです。WSGIのサーバはアプリケーションを走らすために使用され、受信したHTTPリクエストを標準のWSGIのenvironに変換し、送信されるWSGIのレスポンスをHTTPのレスポンスに変換します。(訳注: WSGIではWebサーバとWSGIアプリ間の主要なインタフェースに、サーバからWSGIアプリへ渡す、様々な情報を格納したdictオブジェクトがあり、WSGIの仕様であるPEP 3333ではそれを「environ」と呼んでいます) Flask is a WSGI *application*. A WSGI *server* is used to run the application, converting incoming HTTP requests to the standard WSGI environ, and converting outgoing WSGI responses to HTTP responses.

これらのドキュメントの第一のゴールは、製品版のWSGIサーバとHTTPサーバ(production WSGI servers and HTTP servers)を使ってWSGIアプリケーションを走らせることに関するコンセプトについて、あなたに慣れてもらうことです。多くのWSGIサーバとHTTPサーバがあり、多くの設定の可能性があります。以下のページではもっとも一般的なサーバについて論じて、それぞれのサーバを走らせるための基本を示します。次のセクションでは、あなたに代わってこれを管理できるプラットフォームを論じます。 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.

WSGIサーバは組み込みのHTTPサーバを持ちます。しかしながら、専用のHTTPサーバはより安全で、より効率的で、より高機能かもしれません。WSGIの前面にHTTPサーバを置くことを「リバースプロキシ(reverse proxy)」と呼びます。 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."

このリストは完全なものではなく、そして、自分のアプリケーションのニーズに基づいてこれらとその他のサーバとを評価するべきです。異なるサーバは、異なる機能、設定、サポートをもつことでしょう。 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.

ホスティング・プラットフォーム Hosting Platforms

自分のサーバ、ネットワーク、ドメイン、その他を保守する必要なくwebアプリケーションのホスティングできる、多くのサービスがあります。いくつかのサービスではいくらかの時間または帯域までは無料のものがあるでしょう。これらのサービスの多くは、すでに説明したWSGIサーバのひとつ、または似たインタフェースを使用しています。以下のリンクは、最も一般的なプラットフォームで、Flask、WSGIまたはPython用の使用方法があるものを、いくつかあげたものです。 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.

このリストは完全なものではなく、そして、自分のアプリケーションのニーズに基づいてこれらとその他のサービスとを評価するべきです。異なるサービスは、異なる機能、設定、価格、サポートをもつことでしょう。 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.

殆どのホスティング・プラットフォームで使用時に、Proxyの背後にいることのFlaskへの指示がおそらく必要になるでしょう。 You'll probably need to :doc:`proxy_fix` when using most hosting platforms.