摘要: # admin.py from django.contrib import admin from django.contrib.admin import SimpleListFilter class MyStatusFilter(SimpleListFilter): # 设置过滤标题 title = 阅读全文
posted @ 2024-06-30 16:37 _Q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1. 登录服务器,进入本地mysql数据库,修改 root 账号访问权限为:%,表示所有IP都可以连接 use mysql; update user set host="%" where user="root"; // 刷新权限 FLUSH PRIVILEGES; 2. 查看是否修改成功: sele 阅读全文
posted @ 2024-05-27 21:20 _Q 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 1. 安装 rdbtools pip install rdbtools 2. 安装 python-lzf pip install python-lzf 3. rdb 文件导出为json文件 rdb --c json 路径名称/备份文件名称.rdb -f xx.json 4. 解析json文件 wit 阅读全文
posted @ 2024-04-12 17:52 _Q 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 参考地址: https://geek-docs.com/python/python-ask-answer/683_python_get_video_dimension_in_pythonopencv.html https://blog.csdn.net/m0_61787307/article/det 阅读全文
posted @ 2024-04-09 18:35 _Q 阅读(92) 评论(0) 推荐(0) 编辑
摘要: # 已省略其他配置,只保留匹配步骤 # 访问 https://www.xxx.com/test/1/ https://www.xxx.com/test/2/ ... 时,会跳转 /www/demo/templates/index.html 目录下的静态页面 server { location ~ ^ 阅读全文
posted @ 2024-03-27 18:36 _Q 阅读(41) 评论(0) 推荐(0) 编辑
摘要: 问题:POST请求接口时,请求体数据过大 解决:settings.py # 取消限制 DATA_UPLOAD_MAX_MEMORY_SIZE = None # 或自定义限制,如:6MB DATA_UPLOAD_MAX_MEMORY_SIZE = 6291456 阅读全文
posted @ 2024-02-29 18:41 _Q 阅读(53) 评论(0) 推荐(0) 编辑
摘要: # 背景:可以在admin编辑页面原有基础上,增加一些可定制的功能,如:在本地上传图片到oss,减少服务器的带宽压力,下面就以此为例。 示例图: 一。models.py # video 可以直接用字符串存储,因为最终里面只有有一串oss的视频路径 class News(models.Model): 阅读全文
posted @ 2024-01-29 19:52 _Q 阅读(41) 评论(0) 推荐(0) 编辑
摘要: 用法(将 requests.Session 放到全局调用): import requests rs = requests.Session() def test(request): content = rs.post(url, data, headers=headers) 原理:每次请求都会复用TCP 阅读全文
posted @ 2023-12-21 18:44 _Q 阅读(25) 评论(0) 推荐(0) 编辑
摘要: from itertools import chain from operator import attrgetter # 拿到多条queryset queryset1 = model.objects.filter(status=1).all() queryset2 = model.objects. 阅读全文
posted @ 2023-11-27 18:58 _Q 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 前因:做一个表格页面时,其中有一列网址数据,但这些内容总会超出表格设定的宽度范围,中文就不会,就类似下面这样: 解决(样式中增加下面代码): word-wrap:break-word; 效果: 阅读全文
posted @ 2023-10-24 18:51 _Q 阅读(32) 评论(0) 推荐(0) 编辑