摘要: 隐式授权模式(Implicit Grant) 授权码授权模式(Authorization code Grant) 密码模式(Resource Owner Password Credentials Grant) 客户端凭证模式(Client Credentials Grant) 1.隐式授权模式(Im 阅读全文
posted @ 2020-11-05 20:29 Daniel* 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 1.安装配置 1.1 下载 pip install djangorestframework-jwt 1.2配置settings.py 注册应用 INSTALLED_APPS = [ 'rest_framework_jwt', ] 1.3配置JWT验证 REST_FRAMEWORK = { 'DEFA 阅读全文
posted @ 2020-11-02 20:54 Daniel* 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 1.创建单表模型类 class Goods(models.Model): goods_name = models.CharField(max_length=32) goods_price = models.DecimalField(max_digits=9,decimal_places=2) goo 阅读全文
posted @ 2020-11-01 18:50 Daniel* 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 1.限流 在settings.py中配置 REST_FRAMEWORK = { # 限流(防爬虫) 'DEFAULT_THROTTLE_CLASSES': [ 'rest_framework.throttling.AnonRateThrottle', 'rest_framework.throttli 阅读全文
posted @ 2020-10-28 18:54 Daniel* 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 1.Django序列化 DRF的核心 就是 前后端分离的核心 前后端分离开发的核心: 将模型转换为json 称之为 序列化 将json转换为模型 称之为 反序列化 2.创建模型 '''models.py''' from django.db import models class User(model 阅读全文
posted @ 2020-10-27 19:24 Daniel* 阅读(347) 评论(0) 推荐(0) 编辑
摘要: Django三种风格的模型继承 抽象类继承:父类继承自models.Model,但不会在底层数据库中生成相应的数据表(在Meta方法中添加abstract=True),父类的属性列存储在其子类的数据表中。 多表继承:夺标继承的每个模型类都在底层数据库中生成相应的数据表管理数据。 代理模型继承:父类用 阅读全文
posted @ 2020-10-12 21:49 Daniel* 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 1.微博三方登录流程 https://api.weibo.com/oauth2/authorize? client_id=4122644977 &response_type=code &state=study& forcelogin=true& redirect_uri=https%3A%2F%2F 阅读全文
posted @ 2020-10-09 18:34 Daniel* 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 功能效果 图片点击后根据实际尺寸自动显示 图片加载与关闭淡入淡出 (可以点击本文章图片查看效果) 详戳:https://www.lokeshdhakar.com/projects/lightbox2/ 操作步骤: ####1. 下载压缩包,并解压: https://www.lokeshdhakar. 阅读全文
posted @ 2020-10-09 08:30 Daniel* 阅读(329) 评论(0) 推荐(1) 编辑
摘要: 1.pipeline原理 redis基本语法:https://www.cnblogs.com/xiaonq/p/7919111.html redis四篇:https://www.cnblogs.com/xiaonq/category/1544586.html 1.1 redis发送数据原理 Redi 阅读全文
posted @ 2020-10-08 11:56 Daniel* 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 1.完善注册接口 1.1 修改user/views.py中完善视图函数 # 注册接口 class RegisterView(APIView): """ 用户注册, 权限是: 匿名用户可访问 """ # 自定义权限类 permission_classes = (AllowAny,) def post( 阅读全文
posted @ 2020-10-08 11:55 Daniel* 阅读(72) 评论(0) 推荐(0) 编辑