上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页
摘要: django.core.signing模块 加密: >>> from django.core.signing import Signer >>> signer = Signer() >>> passwd = signer.sign("123456") >>> passwd '123456:fgIOA 阅读全文
posted @ 2021-04-01 17:27 半日闲1 阅读(589) 评论(0) 推荐(0)
摘要: 创建数据库: create database 库名 DEFAULT CHARSET utf8 COLLATE utf8_general_ci; 删除表中的一条数据: delete from 表名 where 条件 修改表中某个字段值: update 表名 set 列名=替换的值 where 条件 修 阅读全文
posted @ 2021-04-01 15:54 半日闲1 阅读(35) 评论(0) 推荐(0)
摘要: 报错:ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory 解决: find / -name libpython3.6m.so.1.0cp libpython3.6m. 阅读全文
posted @ 2021-03-29 16:47 半日闲1 阅读(6535) 评论(0) 推荐(0)
摘要: ip合法性判断: import re def check_ip(ipAddr): compile_ip=re.compile('^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2 阅读全文
posted @ 2021-03-28 14:16 半日闲1 阅读(255) 评论(0) 推荐(0)
摘要: 在 settings.py 文件中进行设置: # session 设置 # 设置session过期行为和时间:(浏览器关闭即session过期,过期时间设定) SESSION_COOKIE_AGE = 60 * 30 # 30分钟 SESSION_SAVE_EVERY_REQUEST = True 阅读全文
posted @ 2021-03-28 14:13 半日闲1 阅读(637) 评论(0) 推荐(0)
摘要: django的filter过滤集合的功能有contains和icontains字段 contains是精确查询,icontains是忽略大小写的模糊查询 params = json.loads(request.body) # dict类型 name = params.get("name", "") 阅读全文
posted @ 2021-03-28 13:57 半日闲1 阅读(178) 评论(0) 推荐(0)
摘要: django中的表单不是html中的那个表单,这里是指django有一个组件名叫表单 1. 创建一个forms.py 文件,放在指定的app当中,然后在里面写表单 2. forms.py 文件写类: from django import forms class targetForm(forms.Fo 阅读全文
posted @ 2021-03-24 22:22 半日闲1 阅读(68) 评论(0) 推荐(0)
摘要: import base64 msg = '123456' msg = msg.encode('utf-8') # 加密 passwd = base64.b64encode(msg) print(passwd) # b'MTIzNDU2' # 解密 res = base64.b64decode(pas 阅读全文
posted @ 2021-03-24 22:09 半日闲1 阅读(227) 评论(0) 推荐(0)
摘要: 1. 安装 pip install django-crontab 2. 添加app 在 settings.py 文件中添加 django-crontab: INSTALLED_APPS = ( ... 'django_crontab', ) 3. 配置 定时函数 在django项目的settings 阅读全文
posted @ 2021-03-21 21:58 半日闲1 阅读(314) 评论(0) 推荐(0)
摘要: super() 函数是用于调用父类(超类)的一个方法。 这里以单继承为例: 没有super().__init__()时调用父类的属性和方法会报错 正确调用: 阅读全文
posted @ 2021-03-16 23:47 半日闲1 阅读(389) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页