Patterns for Flask¶
Certain features and interactions are common enough that you will find them in most web applications. For example, many applications use a relational database and user authentication. They will open a database connection at the beginning of the request and get the information for the logged in user. At the end of the request, the database connection is closed.
These types of patterns may be a bit outside the scope of Flask itself, but Flask makes it easy to implement them. Some common patterns are collected in the following pages.
- Larger Applications
- Application Factories
- Application Dispatching
- Implementing API Exceptions
- Using URL Processors
- Deploying with Setuptools
- Deploying with Fabric
- Using SQLite 3 with Flask
- SQLAlchemy in Flask
- Uploading Files
- Caching
- View Decorators
- Form Validation with 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
- Subclassing Flask
- Single-Page Applications