blueprint和redprint的使用场景区分

来源:4-1 关于“用户”的思考

amberskier

2018-07-25

从您的课程里了解到,blueprint用于更大范围的组织,下面包含redprint,按照官方的blueprint定义:

A Blueprint is a way to organize a group of related views and other code. Rather than registering views and other code directly with an application, they are registered with a blueprint. Then the blueprint is registered with the application when it is available in the factory function.

这里看到blueprint也是用于组织视图函数的,您举的blueprint例子仅用于版本号区分v1,这个例子对我们来说不是很清晰,除了版本区分之外,blueprint可以怎么用?能否给几个更感性的例子?能够体现出和redprint的显著不同

写回答

1回答

7七月

2018-07-25

这个在flask高级编程中其实是有探讨的,比如api可以包含管理系统也就是cms,那么cms admin就是一个蓝图。然后一个API也可以包含多个子项目,子项目也可以是蓝图。

0
2
Linx
老师,如果这样说的话,我想问一下,如何把一个蓝图注册到另一个蓝图中?blueprint.register(blueprint)会报错
2019-09-20
共2条回复

Python Flask高级编程之RESTFul API前后端分离精讲

RESTFul+权限管理+token令牌+扩展flask=提升编程思维

2037 学习 · 359 问题

查看课程