随笔分类 - django
django
django 视图中异步执行python脚本
摘要:python脚本:autoStaticRDMTask.py # import os, django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wanwenyc.settings") django.setup() # # 独运行某一个py文件时会
阅读全文
python 异步执行python脚本
摘要:async_call.py from threading import Thread def async_call(fn): def wrapper(*args, **kwargs): Thread(target=fn, args=args, kwargs=kwargs).start() retur
阅读全文
django 筛选不等于的内容
摘要:myapps = App.objects.filter(name != ''))这种写法是不对的,正确写法是: from django.db.models import Q myapps = App.objects.filter(~Q(name= ''))
阅读全文
django 内联过滤
摘要:class Author(models.Model): name = models.CharField(max_length=50) desc = models.CharField(max_length=50) class Book(models.Model): author = models.Fo
阅读全文
python 字典和json树形输出
摘要:import json a = {}print(json.dumps(a, indent=1))#indent=1代表字节点比父节点前多几个空格
阅读全文
cannot import name 'UnidentifiedImageError'
摘要:更换pillow的版本pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow==4.0.0
阅读全文
pycharm 解决 “ invalid authentication data”
摘要:0.先将pycharm中Settings中的“Version Control” 中无效的Git删除,并且点击OK,确定删除(如果没有,则不需要删除); 1.登录到 “https://github.com/settings/tokens”,将原有的token清空,关闭pycharm,重启pycharm
阅读全文
python解决编码时,单鞋杠变为双斜杠问题
摘要:a = "1D0\x00" b = a.encode("gbk").decode("unicode_escape") #将字符串先编码后解码,解决单斜杠,变为双斜杠问题
阅读全文
django2到3的问题
摘要:1.ImportError: cannot import name 'six' 解决方法 django3已经把six独立出来了,不再包含six 解决方法一: django换回2版本的即可 解决方法二: pip install six 将 "from django.utils import six"换
阅读全文
pip批量更新所有包
摘要:https://blog.csdn.net/sunqiande88/article/details/80155587
阅读全文
Linux umount /data: device is busy已解决
摘要:https://blog.csdn.net/u201017971/article/details/81327360 fuser -m -v /data //v 表示 verbose 模式。进程以 ps 的方式显示,包括 PID、USER、COMMAND、ACCESS 字段 //-m 表示指定文件所在
阅读全文
centos8运行脚本找不到python项目解决
摘要:shell终端进行两步操作即可: (1)export PYTHONPATH=项目路径(ps:如/data/project/test) (2)env | grep PYTHONPATH若有 PYTHONPATH=/data/project/test则说明成功。 在shell脚本中加入python工程路
阅读全文
python虚拟环境冻结与安装
摘要:现将依赖的环境冷冻起来:pip freeze > requirements.txt 创建一个新的空虚拟环境:mkvirtualenv blog 选择新的虚拟环境:workon blogpip 安装相关依赖包:pip install -r requirements.txt 淘宝镜像安装:pip ins
阅读全文
django函数定义上传文件路径
摘要:https://www.pythonheidong.com/blog/article/185397/
阅读全文
django性能优化
摘要:https://blog.csdn.net/weixin_41666747/article/details/100644951 pillow压缩图片 https://blog.csdn.net/lowman2/article/details/90752407 https://blog.csdn.ne
阅读全文
django保存图片到ImageField中
摘要:https://www.jb51.net/article/167140.htm
阅读全文
django指导网址
摘要:https://code.ziqiangxuetang.com/django/django-tutorial.html
阅读全文
pip淘宝镜像安装
摘要:pip install virtualenvwrapper-win pip install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenvwrapper-win pip install -r requirements.txt pip in
阅读全文
自动化框架查询数据库使用语句
摘要:SELECT * FROM `testdatas_inputtapinputtext` WHERE newaddandcheck_id=185 union all SELECT * FROM `testdatas_selecttapselectoption` WHERE newaddandcheck
阅读全文