当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
Prometheus :(一)基本概念
shell 脚本编程---入门
Pytorch最全安装教程(一步到位)
实战noVNC全过程操作(包含遇到的问题和解决)
tensorflow代码翻译成pytorch代码 -详细教程+案例
Flask框架学习:模板渲染与Get,Post请求
Use Adobe genuine software for prostitution to reduce the slow employment and non-employment of fresh graduates
元宇宙社交应用,靠什么吸引用户「为爱发电」?
Delphi7学习记录-demo实例
群晖DS220+ 应用小笔记
leetcode 9. Palindromic Numbers
BitLocker的解密
【无标题】2022年胺基化工艺考试题模拟考试题库及在线模拟考试
BGP综合实验
搭建PX4开发环境
基础数据之double和float区别
[No 2022 Shanghai Security Officer A Certificate Exam Question Bank and Mock Exam
【ARM】rk3399挂载nfs报错
2022 building welder (building a special type of work) examination questions and simulation test
面试宝典二:nlp常见知识点









