当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
基于TF-IDF 文本相似性实战 详细教程
[No 2022 Shanghai Security Officer A Certificate Exam Question Bank and Mock Exam
实战noVNC全过程操作(包含遇到的问题和解决)
第二篇 DS5 Armv8 样例工程报错之GCC编译
[Embedded open source library] The use of cJSON, an efficient and streamlined json parsing library
金仓数据库 KingbaseGIS 使用手册(6.10. 几何对象操作运算符)
tensorflow代码翻译成pytorch代码 -详细教程+案例
四大函数式接口
宝塔Linux环境下redis开启多端口
HAVE FUN | "SOFA Planet" spacecraft plan, the latest progress of source code analysis activities
redis集群模式--解决redis单点故障
Idea 2021.3.3版本文件目录展开
prometheus:(二)监控概述(你永远逃不出我的手掌哈哈)
什么是三次握手和四次挥手(清晰易懂)
Apache Commons OGNL语法说明_翻译
ARM结构体系4:嵌入式硬件平台接口开发
oracle表空间与用户的创建
玩转mysql之查看mysql版本号
shell 脚本编程---入门
BitLocker的解密