摘要: 1.首先使用datetime模块的datetime.now()方法获取当前时间,使用strftime()方法对获取到的日期格式化2.使用open()方法创建相应的文件3.直接上代码如下 import os import datetime import time while True: path = 阅读全文
posted @ 2022-04-01 22:23 叶青IT爱好者 阅读(379) 评论(0) 推荐(0) 编辑
摘要: mysql总结 1.数据库的基础知识 安装 建库 create database db default charset utf8; #创建一个表 show databses; #展示所有的数据库 drop database db #删除表 建表 show tables #展示所有的表 mysql - 阅读全文
posted @ 2021-07-05 21:23 叶青IT爱好者 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 记录学习时间小时分钟秒的字段 duration = models.DurationField(default=datetime.timedelta()) 阅读全文
posted @ 2022-04-22 21:16 叶青IT爱好者 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 当页面上某一块区域的内容需要在多个页面上展示的使用,并且该区域的内容需要通过传参数才能正常显示,那么我们可以优先考虑inclusion_tag模块 自定义标签过滤器inclusion_tag三步骤: 1.在应用下必须新建一个名叫templatetags的文件夹 2.在文件夹下新建任意名称的py文件比 阅读全文
posted @ 2022-04-05 21:42 叶青IT爱好者 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1.安装第三方模块 pip install xpinyin 2.实现代码如下: 1 from xpinyin import Pinyin 2 3 def my_sort(wordlist): # 指定要排序的列表 4 pin = Pinyin() # 创建汉字转拼音的对象 5 temp = [] # 阅读全文
posted @ 2022-03-31 21:46 叶青IT爱好者 阅读(260) 评论(0) 推荐(0) 编辑
摘要: celery是一个基于Python开发的模块,可以帮助我们对任务进行分发和处理。 1.1 环境的搭建 pip3 install celery==4.4 安装broker: redis或rabbitMQ pip3 install redis / pika 1.2 快速使用 s1.py from cel 阅读全文
posted @ 2021-08-02 20:34 叶青IT爱好者 阅读(49) 评论(0) 推荐(0) 编辑
摘要: from rest_framework.authentication import BaseAuthentication from api import models from rest_framework import exceptions class GeneralAuthentication( 阅读全文
posted @ 2021-07-31 11:02 叶青IT爱好者 阅读(59) 评论(0) 推荐(0) 编辑
摘要: import os import sys import django base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(base_dir) # 将配置文件的路径写到 DJANG 阅读全文
posted @ 2021-07-31 10:54 叶青IT爱好者 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 1.项目下创建一个文件.gitignore里面写上 # pycharm .idea/ .DS_Store __pycache__/ *.py[cod] *$py.class # Django stuff: local_settings.py *.sqlite3 # database migratio 阅读全文
posted @ 2021-07-23 22:53 叶青IT爱好者 阅读(43) 评论(0) 推荐(0) 编辑
摘要: <!doctype html>day08 认证相关 day08 认证相关 认证结合之后的效果: 发布页:未登录,点发布跳转到登录页面。 首页:不用登录 详细页面:不用登录、如果登录就需要在访问记录中添加一条数据。 评论,跳转到登录页面 点赞,跳转到登录页面 个人中心,无需登录 登录页面,无需登录 今 阅读全文
posted @ 2021-07-22 19:47 叶青IT爱好者 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 函数的作用:对功能或者动作的封装 定义: def 函数名(形参): 函数体 return 顺序位置形参: 位置参数 args 默认值 kwagrs 减少重复代码 提高重用性 函数的闭包:内层函数对外城的变量的使用 作用:可以让一个变量被封锁起来,外界只能看到,但是改不了 可以让一个变量常驻内存 de 阅读全文
posted @ 2021-07-11 15:06 叶青IT爱好者 阅读(57) 评论(0) 推荐(0) 编辑