03 2022 档案

摘要:保存数据 验证成功之后把数据传入数据库中进行保存,要基于validated_data完成数据库对象的创建,此时永达create()和update()方法实现 定义create()和update()方法 def create(self, validated_data): """ 新建 create v 阅读全文
posted @ 2022-03-31 15:51 Jaetyn 阅读(466) 评论(0) 推荐(0) 编辑
摘要:1.登录: mysql -u root -p 2.创建数据库并指定字符集(较为重要) GBK: create database test2 DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci; UTF8: CREATE DATABASE `test2` 阅读全文
posted @ 2022-03-30 10:05 Jaetyn 阅读(4013) 评论(0) 推荐(0) 编辑
摘要:示例(一对多查询) Serializer.py class BusinessSerializer(serializers.ModelSerializer): department = serializers.CharField(required=True,source="businessName") 阅读全文
posted @ 2022-03-23 21:00 Jaetyn 阅读(387) 评论(0) 推荐(0) 编辑
摘要:fileDownloads.py # 切片读取文件 def file_iterator(filename,chunk_size=512): with open(filename,'rb') as f: while True: c=f.read(chunk_size) if c: yield c el 阅读全文
posted @ 2022-03-23 09:50 Jaetyn 阅读(1687) 评论(0) 推荐(0) 编辑
摘要:import django_filters from publicModels.models import Staff class StaffFilter(django_filters.FilterSet): username = django_filters.CharFilter(lookup_e 阅读全文
posted @ 2022-03-11 14:25 Jaetyn 阅读(815) 评论(0) 推荐(0) 编辑
摘要:转载自:https://www.cnblogs.com/testlearn/p/14426580.html import os def find_file(search_path, include_str=None, filter_strs=None): """ 查找指定目录下所有的文件(不包含以_ 阅读全文
posted @ 2022-03-11 14:22 Jaetyn 阅读(3797) 评论(0) 推荐(0) 编辑
摘要:1.确保python已经搭建(推荐建立虚拟环境) 2.确保python库中存在uwsgi 3.确保Nginx已经正确安装 提醒:注意要将自己云服务器上的端口开启 uwsgi参数 例如: uwsgi --chdir /DjangoProject/performanceAppraisal/ --modu 阅读全文
posted @ 2022-03-07 17:29 Jaetyn 阅读(78) 评论(0) 推荐(0) 编辑
摘要:参考文章:https://blog.csdn.net/qq_43475097/article/details/83784305 解决Django + DRF:403 FORBIDDEN:CSRF令牌丢失或不正确,{“detail”:“CSRF Failed: CSRF cookie not set. 阅读全文
posted @ 2022-03-07 16:31 Jaetyn 阅读(819) 评论(0) 推荐(0) 编辑