摘要: CBV&APIView 权限&频率组件 内置频率组件 版本控制组件 解析器 序列化组件 视图组件 阅读全文
posted @ 2019-04-12 13:02 SwZ1886 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-04-12 12:37 SwZ1886 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 文件: mkdir--创建目录 ls--查看目录内容(-l)详细信息 -lhi 文件属性 lsof --查看系统所有文件 touch--创建文件 vi--vim(主要使用) 打开文件之后按i 编辑 esc退出 :wq保存并退出 :q!不保存 o移动到最后一行并编辑 G移动到最后一行 gg移动到第一行 阅读全文
posted @ 2019-04-12 11:31 SwZ1886 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 指定元类 元类实现单例 阅读全文
posted @ 2019-04-12 11:16 SwZ1886 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 1.__setattr__,__delattr__,__getattr__,__getattribute__ __setattr__ 点语法添加/修改属性会触发它的执行 __delattr__ 点语法删除属性的时候会触发 del obj.attr __getattr__ 只有在使用点调用属性且属性不 阅读全文
posted @ 2019-04-12 11:12 SwZ1886 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 1xx 这一类型的状态码,代表请求已被接受,需要继续处理。 100 Continue 收到请求,客户端应当继续发送请求。 101 Switching Protocols 服务器通过 Upgrade 消息头通知客户端采用不同的协议来完成这个请求。 2xx 成功 | 这一类型的状态码,代表请求已成功被服 阅读全文
posted @ 2019-04-12 11:10 SwZ1886 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Python标准异常总结 AssertionError 断言语句(assert)失败 AttributeError 尝试访问未知的对象属性 EOFError 用户输入文件末尾标志EOF(Ctrl+d) FloatingPointError 浮点计算错误 GeneratorExit generator 阅读全文
posted @ 2019-04-12 11:09 SwZ1886 阅读(147) 评论(0) 推荐(0) 编辑
摘要: random.seed(a=None, version=2) # 初始化伪随机数生成器。如果未提供a或者a=None,则使用系统时间为种子。如果a是一个整数,则作为种子。 random.getstate() # 返回一个当前生成器的内部状态的对象 random.setstate(state) # 传 阅读全文
posted @ 2019-04-12 11:08 SwZ1886 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 查看服务 desc mysql.user; 1.mysql服务的启动和停止net stop mysqlnet start mysql 2.登陆mysql语法如下: mysql -u用户名 -p用户密码 键入命令mysql -uroot -p, 回车后提示你输入密码,如果是连接到另外的机器上,则需要加 阅读全文
posted @ 2019-04-12 11:07 SwZ1886 阅读(117) 评论(0) 推荐(0) 编辑
摘要: """ logging配置 """ import os import logging.config # 定义三种日志输出格式 开始 standard_format = '[%(asctime)s][%(threadName)s:%(thread)d][task_id:%(name)s][%(filename)s:%(lineno)d]' \ '[%(le... 阅读全文
posted @ 2019-04-12 11:06 SwZ1886 阅读(139) 评论(0) 推荐(0) 编辑
摘要: sort_keys=True, indent=4, separators=(',', ': ') #格式 json.dumps(response,sort_keys=True, indent=4, separators=(',', ': '),ensure_ascii=False) #ensure_ascii 解析中文 #自定制json class MEncode(json.JSON... 阅读全文
posted @ 2019-04-12 11:05 SwZ1886 阅读(131) 评论(0) 推荐(0) 编辑
摘要: git config --global user.name 'x'git config --global user.email 'x' git init 将目录变为git库 git add readme.txt 添加文件 git rm test.txt 删除文件 git commit -m "wro 阅读全文
posted @ 2019-04-12 11:02 SwZ1886 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 基本使用 框架结构 手动添加任务 result查看结果 定时任务 循环定时提交任务 阅读全文
posted @ 2019-04-12 11:00 SwZ1886 阅读(241) 评论(1) 推荐(0) 编辑
摘要: 库 表 字段 单表查询: 多表查询: 阅读全文
posted @ 2019-04-12 10:54 SwZ1886 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 序列化组件 -Serializer -ModelSerializer #ModelSerializer方法 queryset.is_valid() #校验数据 queryset.save() #保存在数据库 -HyperlinkedModelSerializer 视图组件ModelViewSet V 阅读全文
posted @ 2019-04-12 10:38 SwZ1886 阅读(124) 评论(0) 推荐(0) 编辑
摘要: from django import templateregister = template.Library() --自定义过滤器tamplatetags from django.urls import reverse --反向解析views from django.conf.urls import 阅读全文
posted @ 2019-04-12 10:38 SwZ1886 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 配置mysql 配置mongodb static静态文件 media静态文件 auth模块未登录跳转 auth模块自定义User表 时区的配置 阅读全文
posted @ 2019-04-12 09:58 SwZ1886 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 路由分发 反向解析url 自定义模板过滤器/标签 cookie/session cookie session 中间件 自定义中间件 forms组件 编写forms类 常用字段: min_length, label initial 初始值 error_messages = {} 错误提示 widget 阅读全文
posted @ 2019-04-12 09:52 SwZ1886 阅读(87) 评论(0) 推荐(0) 编辑
摘要: https://docs.djangoproject.com/en/1.11/ref/request-response/ path_info 返回用户访问url,不包括域名method 请求中使用的HTTP方法的字符串表示,全大写表示。GET 包含所有HTTP GET参数的类字典对象POST 包含所 阅读全文
posted @ 2019-04-12 09:46 SwZ1886 阅读(129) 评论(0) 推荐(0) 编辑
摘要: class Pagination(object): def __init__(self, current_page, all_count, per_page_num=2, pager_count=11): """ 封装分页相关数据 :param current_page: 当前页 :param all_count: 数... 阅读全文
posted @ 2019-04-12 09:44 SwZ1886 阅读(79) 评论(0) 推荐(0) 编辑