11 2022 档案

摘要:django聚合查询与分组查询 例题 聚合、分组查询 # 所有书的平均价格 avg_query = Book.objects.all().aggregate(Avg("price")) print(avg_query) # {'price__avg': Decimal('93.68888888888 阅读全文
posted @ 2022-11-23 22:04 zong涵 阅读(140) 评论(0) 推荐(0) 编辑
摘要:Simple JWT 安装 pip install djangorestframework_simplejwt settings.py REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework_simplejwt.a 阅读全文
posted @ 2022-11-22 22:05 zong涵 阅读(964) 评论(2) 推荐(1) 编辑
摘要:drf结合rest-pandas实现下载excel文件 下载rest-pandas pip install rest-pandas 使用方法 在views.py文件中 from rest_pandas.views import PandasViewBase from rest_pandas.rend 阅读全文
posted @ 2022-11-17 17:35 zong涵 阅读(399) 评论(0) 推荐(0) 编辑
摘要:Django出现RuntimeError: populate( ) isn't reentrant问题 问题描述 这个错误信息是一个笼统的错误信息,这里django把他真正的错误信息隐藏了。因此如果想得到真正的报错信息需要改源码,位置就在下方报错信息的"/Users/zonghan/PycharmP 阅读全文
posted @ 2022-11-10 11:56 zong涵 阅读(1314) 评论(2) 推荐(1) 编辑
摘要:python PDF转图片 准备工作 下载模块pdf2image pip install pdf2image 下载依赖(不下载会报错) Mac brew install poppler 代码实现 from pdf2image import convert_from_path, convert_fro 阅读全文
posted @ 2022-11-08 13:38 zong涵 阅读(107) 评论(0) 推荐(0) 编辑
摘要:django FileResponse下载文件 代码如下: from django.http import FileResponse def get(self, request, *args, **kwargs): file_path = /Users/zonghan/Desktop/1.txt r 阅读全文
posted @ 2022-11-01 16:56 zong涵 阅读(734) 评论(0) 推荐(0) 编辑

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