上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 24 下一页
摘要: 展现方式:点击按钮向后端发起请求,获取数据并展示到前端 呈现效果: 实现方式如下: 第一步:使用Django框架书写后端代码,返回数据(用户名与年龄) 视图类: from rest_framework.views import APIView from rest_framework.response 阅读全文
posted @ 2024-01-09 16:26 wellplayed 阅读(123) 评论(0) 推荐(0)
摘要: 呈现效果: 第一步:引入vue与bootstrap的CDN <script src="./js/vue.js"></script> <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4 阅读全文
posted @ 2024-01-09 15:51 wellplayed 阅读(317) 评论(0) 推荐(0)
摘要: 呈现效果: 第一步:定义一个id为app的div <div id="app"> <h1>过滤案例</h1> // 绑定input事件、记录用户输入数据search <input type="text" v-model="search" @input="handleSearch"> <ul> // 循 阅读全文
posted @ 2024-01-08 18:55 wellplayed 阅读(55) 评论(0) 推荐(0)
摘要: 视图函数内书写如下代码: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.request_action = None def initialize_request(self, request, * 阅读全文
posted @ 2024-01-04 21:11 wellplayed 阅读(39) 评论(0) 推荐(0)
摘要: 自定义表签发token 不通过auth_user表,而是通过自定义表实现签发token 代码如下: 表模型: class UserInfo(models.Model): username = models.CharField(max_length=32) password = models.Char 阅读全文
posted @ 2024-01-04 16:35 wellplayed 阅读(77) 评论(0) 推荐(0)
摘要: restful规范(10条) 1 数据的安全保障:url链接一般都采用https协议进行传输 -https是:http+ssl 安全的超文本传输协议 2 接口特征表现:在API地址中带接口标识,咱们一般放在地址栏中(放在域名中) https://api.baidu.com https://www.b 阅读全文
posted @ 2024-01-04 09:23 wellplayed 阅读(60) 评论(0) 推荐(0)
摘要: 需求如下: 用户输入:用户名或手机号或邮箱 +密码都能登录,并签发token 代码书写: model层配置(需要扩写auth_user表): from django.contrib.auth.models import AbstractUser class User(AbstractUser): m 阅读全文
posted @ 2024-01-03 21:12 wellplayed 阅读(158) 评论(0) 推荐(0)
摘要: 定制返回格式 目标如下: 想要返回如下格式数据: { code:100, msg:'登录成功', username:'登录用户名字', access:asdfasdf.asdfasdf.asdfasdf refresh:asdfas.ere.we } 第一步:新建一个序列化类文件,以serializ 阅读全文
posted @ 2024-01-03 20:42 wellplayed 阅读(67) 评论(0) 推荐(0)
摘要: jwt的使用步骤 第一步:安装模块 pip install djangorestframework-simplejwt 第二步:注册app # settings文件配置 INSTALLED_APPS = [ ... 'rest_framework_simplejwt', ... ] 第三步:sett 阅读全文
posted @ 2024-01-03 20:35 wellplayed 阅读(65) 评论(1) 推荐(1)
摘要: access:真正使用的token refresh:用来更新access access过期时间很短,过期后,需要使用refresh重新生成access的token以保证token的安全 阅读全文
posted @ 2024-01-03 20:33 wellplayed 阅读(40) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 24 下一页