Flask 代码模式¶
某些东西非常通用,以至于你有很大的机会在绝大部分 Web 应用中,都能找到他们的身影。 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.
Flask代码片段归档中有用户贡献的更多片段和模式。
- 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
- MongoKit in Flask
- Adding a favicon
- Streaming Contents
- Deferred Request Callbacks
- Adding HTTP Method Overrides
- Request Content Checksums
- Celery Based Background Tasks
- Subclassing Flask