10 2022 档案

摘要:1. cookie,session、token介绍 cookie介绍 cookie指的时浏览器里面能够永久存储的一种数据,仅仅是浏览器实现的一种数据存储功能 cookie由服务器生成,发送给浏览器。 浏览器把cookie以KV键值对的形式保存到某个目录下的文本文件内,下次请求同一网站时会把cooki 阅读全文
posted @ 2022-10-12 22:15 瓮小辉 阅读(92) 评论(0) 推荐(0) 编辑
摘要:DRF 分页、排序、过滤 1. 自定义频率类 class NewThrottle(BaseThrottle): # 存放用户访问记录 user_dict = {} # 格式:{用户ip:[访问时间1,访问时间2]} # 获取当前时间 now_time = time.time def __init__ 阅读全文
posted @ 2022-10-11 22:10 瓮小辉 编辑
摘要:全局异常处理、接口文档 1. 内置认证类、权限类、频率类 1.1 内置的认证类 ·BasicAuthentication ·RemoteUserAuthentication ·SessionAuthentication:session认证, 如果前端带着cookie过来,经过session的中间件, 阅读全文
posted @ 2022-10-11 21:48 瓮小辉 编辑
摘要:DRF 认证、权限、频率 1. 认证类使用 1.1 使用步骤 # 导入: from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions import Authentication 阅读全文
posted @ 2022-10-09 21:28 瓮小辉 阅读(40) 评论(0) 推荐(0) 编辑
摘要:1. 路由 自动生成路由 SimpleRouter使用 # urls.py from django.contrib import admin from django.urls import path, include from app01 import views # 导入 from rest_fr 阅读全文
posted @ 2022-10-08 20:41 瓮小辉 阅读(38) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示