当前位置:网站首页>Django--20 implements Redis support, context, and interaction of context and interface
Django--20 implements Redis support, context, and interaction of context and interface
2022-08-11 05:34:00 【no longer stay up late】
1. Business scenario analysis
1. System to be tested
Typical front-end and back-end separation system
yshop e-commerce background
2. Login scenario
1. Get the verification code question and uuid
Interface: /auth/code
Purpose: Get the UUID as the redis key to get the verification code answer
redis: Not Only SQL
2. Get the verification code answer (redis)
Interface: redis
Purpose: Get the verification code answer and pass it to the login interface
3. Call the login interface
Interface: /auth/login
Purpose: Get the authentication token (Bearer Token), which is used by all subsequent interfaces that need to be verified
4. Get the list of user interfaces
Interface: /api/users
Purpose: Verify that the token is valid
Interlude: mysql and redis comparison
Second, analysis of implementation ideas
1. Must be able to call redis
2. Context must be maintained between the front and rear interfaces
Thinking: Where is the context stored?is a scalar?dictionary?Or a list?
3, must be able to save the interface execution result to the context
4. Must be able to obtain data from the context as interface runtime parameters
Request Header
Request Body
Query Parameters
redis key
Three, sorting out the landing steps
1. Implement redis support (implement mysql support)
Preparation:
1. Install redis
pip install red
边栏推荐
猜你喜欢
随机推荐
PCIe 接口 引脚定义 一览表
【嵌入式开源库】使用J-Link打印日志,让你节省一个打印串口
Unity WebGL RuntimeError: integer overflow(整数溢出问题)
第二篇 DS5 Armv8 样例工程报错之GCC编译
每周推荐短视频:你常用的拍立淘,它的前身原来是这样的!
MySQL事务的概念
分库分表之sharding-proxy
nodes服务器
将double类型的数据转为字符串
滴滴出行 nlp算法工程师面试经验分享 带offer截图真实
玩转mysql之查看mysql版本号
BGP综合实验
一个月闭关直接面进大厂,这份Android面试笔记是真的牛逼
让你代码越来越高大上的技巧——代码规范,你得知道
【嵌入式开源库】cJSON的使用,高效精简的json解析库
IDEA使用记录
selenuim使用cookie登录京东
Let's talk programming languages together
Mysql入门练习
MyEclipse数据库工具使用教程:使用驱动程序









