Flaskのパターン Patterns for Flask¶
とてもありがちで、ほとんどのwebアプリケーションで見られる可能性が高いものがいくつかあります。例えば、非常に多くのアプリケーションでリレーショナルデータベースとユーザ認証が使われます。その場合、リクエストの始めにデータベース接続(connection)を開き、その時ログインしているユーザの情報を取得することがありがちです。リクエストの終わりには、データベース接続は再び閉じられます。 Certain things are common enough that the chances are high you will find them in most web applications. For example quite a lot of applications are using relational databases and user authentication. In that case, chances are they will open a database connection at the beginning of the request and get the information of the currently logged in user. At the end of the request, the database connection is closed again.
ユーザが貢献したコード断片(snippets)やパターンが、Flask Snipet Archivesに更に数多くあります。 There are more user contributed snippets and patterns in the `Flask Snippet Archives <http://flask.pocoo.org/snippets/>`_.
- より大きなアプリケーション
- アプリケーション製造工場(Application Factories)
- アプリケーションの振り分け(Application Dispatching)
- Implementing API Exceptions
- Using URL Processors
- Setuptoolsを使った展開(Deploying with Setuptools)
- Deploying with Fabric
- FlaskでのSQLite 3の使用
- Flask内でのSQLAlchemy(SQLAlchemy in Flask)
- ファイルのアップロード
- キャッシング
- View Decorators
- WTFormsを使ったフォーム検証
- Template Inheritance
- Message Flashing
- AJAX with jQuery
- Custom Error Pages
- Lazily Loading Views
- MongoDB with MongoEngine
- Adding a favicon
- Streaming Contents
- Deferred Request Callbacks
- Adding HTTP Method Overrides
- Request Content Checksums
- Celery Background Tasks
- Flaskのサブクラス化
- Single-Page Applications