チュートリアル Tutorial

このチュートリアルはFlaskrと呼ぶ基本的なブログのアプリケーションの作成を一通り行います。ユーザはユーザ登録、ログイン、投稿記事の作成、自分の投稿記事の編集および削除が可能になります。アプリケーションをパッケージ化して、別のコンピュータへのインストールもできるようになります。 This tutorial will walk you through creating a basic blog application called Flaskr. Users will be able to register, log in, create posts, and edit or delete their own posts. You will be able to package and install the application on other computers.

screenshot of index page

Pythonには既に親しんでいる前提とします。Pythonドキュメントのofficial tutorialは、最初に学習または見直しをするには素晴らしい方法です。 It's assumed that you're already familiar with Python. The `official tutorial`_ in the Python docs is a great way to learn or review first.

このチュートリアルは良い開始場所になるよう意図されたものですが、Flaskの目玉機能(feature)をすべて網羅しているわけではありません。Flaskで何ができるかの概要をクイックスタートで調べて、それから、より多くを知るためにドキュメントを掘り下げてください。このチュートリアルはFlaskとPythonが提供しているものだけを使用します。他のプロジェクトでは、いくつかのタスクをよりシンプルにするためにFlask拡張(Extensions)やその他のライブラリを使用する決定をくだすかもしれません。 While it's designed to give a good starting point, the tutorial doesn't cover all of Flask's features. Check out the :ref:`quickstart` for an overview of what Flask can do, then dive into the docs to find out more. The tutorial only uses what's provided by Flask and Python. In another project, you might decide to use :ref:`extensions` or other libraries to make some tasks simpler.

screenshot of login page

Flaskには柔軟性があります。Flaskでは、プロジェクトまたはコードの特定のレイアウト(訳注: ディレクトリ構成のことと考えておおよそ問題ありません)は、何も要求していません。しかしながら、初めて開始するときには、それよりは構造が定まったアプローチを使用した方が役立ちます。これは、このチュートリアルでは前もってひな形を少し要求しようとすることを意味しますが、それは新しい開発者が出くわす多くのありがちな罠を回避するためであり、さらに容易に拡張できるプロジェクトを作り出します。Flaskをより快適に感じるようになったら、ここで示す構造から足を踏み出して、Flaskの柔軟性を存分に活用してください。 Flask is flexible. It doesn't require you to use any particular project or code layout. However, when first starting, it's helpful to use a more structured approach. This means that the tutorial will require a bit of boilerplate up front, but it's done to avoid many common pitfalls that new developers encounter, and it creates a project that's easy to expand on. Once you become more comfortable with Flask, you can step out of this structure and take full advantage of Flask's flexibility.

screenshot of login page

もし自分の(チュートリアル実施途中での)プロジェクトと、このチュートリアルに従った時の最終成果物を比較したい場合は、このチュートリアルのプロジェクトはFlaskリポジトリ中にある例から入手可能です :gh:`The tutorial project is available as an example in the Flask repository <examples/tutorial>`, if you want to compare your project with the final product as you follow the tutorial.

プロジェクトのレイアウトへ続きます。 Continue to :doc:`layout`.