【未完待续。。。】
今年的PyCon大会,miguel grinberg 作了《flask-at-scale》演讲,提出了一些模式和最佳实践,来让微框架提升到下一层次
Do you think that because Flask is a micro-framework, it must only be good for small, toy-like web applications? Well, not at all! In this tutorial I am going to show you a few patterns and best practices that can take your Flask application to the next level.
视频:土豆网
听众对象:中、高级 intermediate and advanced Flask developers
Scale是指:程序规模和负载 both in terms of application size and load
- 如何组织大规模的程序:代码结构、模板、静态文件 Large applications: How to organize code, templates and static files in a way that allows the application to grow without becoming a mess.
- 如何处理超大负载 Flask under load: Different ways to deploy a Flask application so that it can handle large numbers of clients.
演讲目录:
Introduction (10 min) 大型程序规模 Large applications (1 hour)
- 如何组织大型程序(代码、文件)How to structure a large application
- 使用蓝图来组啥 Using Blueprints to organize an application
- 装饰器来简化代码 Decorators as a way to simplify application code
- 网站开发和REST API相互绑定 Combining a web application with a REST API
- API 用版本区分 API versioning
Flask应对大负载 Flask under load (1 hour)
请求异步化 Asynchronous requests 使用Celery模块来处理工作队列 Using a Celery job queue 使用多进程及负载均衡器 Using multiple processes and hosts with a load balancer
使用eventlet/gevent 高性能网络编程并发框架 Using coroutine frameworks such as eventlet or gevent
使用WebSocket降低延时 Using WebSocket for server-push and reduced latency
Free-form Discussion and Q&A (50 min)