摘要: 一、redis简介 介绍: redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。这些数据类型都支持push/pop 阅读全文
posted @ 2020-08-20 08:28 lxttt521 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 一、模型部分 1 关于ForeignKey 1.1 级联 在django2版本以上,外键关联的数据需要设置级联更新 xxx = models.ForeignKey(关联的表,on_delete=model.CASCADE) # 级联操作需要注意,如果是一对一的关联,那没问题应该级联删除 # 但如果是 阅读全文
posted @ 2020-08-19 17:15 lxttt521 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 一、安装 #1 pip3 install scrapy(mac,linux) #2 windows上(80%能成功,少部分人成功不了) 1、pip3 install wheel #安装后,便支持通过wheel文件安装软件,wheel文件官网:https://www.lfd.uci.edu/~gohl 阅读全文
posted @ 2020-08-06 10:08 lxttt521 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 如果我们要用排序,那么写的视图类就必须直接或间接继承ListModelMixin,因为其内部有帮我们排序的放方法 ListModelMixin # 调用了视图类对象的filter_queryset方法 queryset = self.filter_queryset(self.get_queryset 阅读全文
posted @ 2020-07-27 20:58 lxttt521 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 一、celery介绍 Celery 官网:http://www.celeryproject.org/ Celery 官方文档英文版:http://docs.celeryproject.org/en/latest/index.html Celery 官方文档中文版:http://docs.jinkan 阅读全文
posted @ 2020-07-25 11:55 lxttt521 阅读(308) 评论(2) 推荐(0) 编辑
摘要: 一、同源策略 同源策略:请求的url地址,必须与浏览器上的url地址处于同域上,也就是域名,端口,协议相同 比如:我在本地上的域名是127.0.0.1:8000,请求另外一个域名:127.0.0.1:8001一段数据 浏览器上就会报错,这就是同源策略的保护,如果浏览器对javascript没有同源策 阅读全文
posted @ 2020-07-17 16:31 lxttt521 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 一、普通加速 """ 1、采用国内源,加速下载模块的速度 2、常用pip源: -- 豆瓣:https://pypi.douban.com/simple -- 阿里:https://mirrors.aliyun.com/pypi/simple 3、加速安装的命令: -- >: pip install 阅读全文
posted @ 2020-07-17 15:57 lxttt521 阅读(2336) 评论(0) 推荐(1) 编辑
摘要: 一、自动签发 urls from rest_framework_jwt.views import obtain_jwt_token # 使用jwt自带的登录视图 urlpatterns = [ path('login/', obtain_jwt_token), ] settings import d 阅读全文
posted @ 2020-07-15 19:33 lxttt521 阅读(315) 评论(0) 推荐(1) 编辑
摘要: 一、drf频率源码分析 from rest_framework.throttling import SimpleRateThrottle # 在频率限制中最重要的方法就是allow_request # 可以直接去频率类的顶级父类里找,告诉我们如果要写频率限制,就必须重写这个方法,返回值True/Fa 阅读全文
posted @ 2020-07-14 18:09 lxttt521 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 一、三种分页模式 1 PageNumberPagination from rest_framework.pagination import PageNumberPagination,LimitOffsetPagination,CursorPagination class Mypagination(P 阅读全文
posted @ 2020-07-13 19:41 lxttt521 阅读(119) 评论(0) 推荐(0) 编辑