当前位置:网站首页>[flask] red map for module splitting
[flask] red map for module splitting
2022-08-05 22:04:00 【a flaming flower】
Introduction
Redprint, as the name suggests - Redprint.Blueprints are module-level splits, they're not designed to let you split up functions.To achieve a more specific split of view functions than at the module level, for example, when using Flask to create a REST API, when splitting according to the functions of different business objects under the version number, we need to customize a module with the same function as the blueprint.Here, in order to reflect the similarities and purposes of the blueprint, we named it the red map!
use
To implement Redprint, mainly refer to the source code/principle of blueprint to make some transformations redprint.pyfile
class Redprint:def __init__(self, name):self.name = nameself.mound = []def route(self, rule, **options):def decorator(f):self.mound.append((f, rule, options))return freturn decoratordef register(self, bp, url_prefix=None):if url_prefix is None:url_prefix = '/' + self.namefor f, rule, options in self.mound:endpoint = options.pop("endpoint", f.__name__)bp.add_url_rule(url_prefix + rule, endpoint, f, **options)Define red map
from app.utils.redprint import RedprintredApi = Redprint('api')- Register red image
from app.v1.api import redApicmsBlue = Blueprint('api_v1', __name__, template_folder='templates')redApi.register(cmsBlue, url_prefix='api')边栏推荐
- 推送消息到手机
- [ssh] Solve the problem that the debian 11 system crt cannot ssh login
- selenium测试浏览器指纹
- nodejs(三)模块化,exports对象,npm与包的分类和结构,模块分类,模块作用域,exports对象,dependencies与devDepndencies节点,nrm,i5ting_toc
- CFdiv2-Chip Move-(线性dp+状态枚举方式)
- [debian]cockpit 报错Cannot refresh cache whilst offline
- mysql- 忘记root密码怎么办?mysql密码破解
- APS在印刷行业的应用前景和应用效益
- CTO不让用Calendar,那用啥?
- 什么情况会导致 MySQL 索引失效?
猜你喜欢

MySQL中常见的嵌套查询有哪些
![[LeetCode] 39, combined sum](/img/f0/834ac6e39e2d5f2767fb6af63e6d2f.png)
[LeetCode] 39, combined sum

nodejs(一)fs模块(操作文件的模块),path路径模块,路径拼接path.join,抵消两层路径的写法,浏览器中的js

元宇宙互操作性解决虚拟消费的顾虑

智慧的仓库管家——WMS

与第三方iot平台IFTTT&Smartthings&Google对接开发iot物联网云服务

什么情况会导致 MySQL 索引失效?

关于求直线交点的问题。

ESP8266-Arduino编程实例-金属触摸传感器驱动

60:第五章:开发admin管理服务:13:开发【新增/修改友情链接,接口】的新增功能;(向MongoDB中,新增数据)(操作MongoDB的Dao层接口,得继承MongoRepository接口;)
随机推荐
Digital twins remove the "blind spots" of smart cities and empower the digital development of society
MQ的概念
SciencePlot-Science Plot
7月末出去玩啦,给大家分享一个青岛攻略吧~
mvcc机制中的快照读和当前读
C语言基础演练(9)
ESP8266-Arduino编程实例-金属触摸传感器驱动
Qt使用wget下载文件案例
JS日期工具类
Cadence学习篇(12) Cadence中使用Pspice进行电路仿真
Apache Log4j2远程代码执行漏洞复现(CVE-2021-44228)
什么情况会导致 MySQL 索引失效?
mysql- 忘记root密码怎么办?mysql密码破解
LightningChart .NET v10.3.2
使用ComposeDesktop开发一款桌面端多功能APK工具
论如何下载网页中的m3u8/ts视频
uni开发微信小程序使用camera遇到的问题
有关CRT密码反编译问题
推送消息到手机
一看就懂的:MySQL的Double Write