上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页

2020年4月8日

理解SQLAlchemy的表继承关系(1)--Joined Table Inheritance

摘要: Joined Table Inheritance指通过外健方式进行链接实现的继承方式。 举个例子理解,共三个ORM类: Employee:员工,基类,具有id,name两个共有字段Manager:经理,继承Employee Engineer:工程师,继承Employee,在本例中,SQLAlchem 阅读全文

posted @ 2020-04-08 11:44 不要挡着我晒太阳 阅读(591) 评论(0) 推荐(0) 编辑

2020年4月7日

-bash: gunicorn: command not found

摘要: 原因:未配置环境变量 解决:我安装gunicorn用的pip3,所以找到python3的bin目录,将入环境变量即可 export PATH=$PATH:/usr/local/python3/bin 阅读全文

posted @ 2020-04-07 18:31 不要挡着我晒太阳 阅读(4492) 评论(0) 推荐(1) 编辑

适配模式

摘要: 适配器模式 Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of in 阅读全文

posted @ 2020-04-07 18:27 不要挡着我晒太阳 阅读(178) 评论(0) 推荐(0) 编辑

2020年4月3日

模型继承的三种方式

摘要: django中的继承有三类; 1.抽象继承 2.多表继承 3.proxy model(代理模型) 第1种情况表示你的父类仅仅是包含了多个子类的相同的字段,是为了重用,不会建表,我们只需要在抽象父类的Meta中设置abstract=True就行。比如: class CommonInfo(models. 阅读全文

posted @ 2020-04-03 20:17 不要挡着我晒太阳 阅读(483) 评论(0) 推荐(0) 编辑

记ABC类的bug

摘要: 监听模式中,建了模式父类 class Observer(ABCMate): @abstractmethod def update(self,waterHeater): pass 洗澡模式: class WashingMode(Observer): def update(self,waterHeate 阅读全文

posted @ 2020-04-03 14:00 不要挡着我晒太阳 阅读(416) 评论(0) 推荐(0) 编辑

2020年4月2日

CAP原则(CAP定理)、BASE理论

摘要: 一、CAP原则 CAP原则又称CAP定理,指的是在一个分布式系统中, Consistency(一致性)、 Availability(可用性)、Partition tolerance(分区容错性),三者不可得兼。 CAP原则是NOSQL数据库的基石。 分布式系统的CAP理论:理论首先把分布式系统中的三 阅读全文

posted @ 2020-04-02 18:08 不要挡着我晒太阳 阅读(223) 评论(0) 推荐(0) 编辑

Python自动群发邮件

摘要: import smtplib from email import (header) from email.mime import (text, application, multipart) import time def sender_mail(): smt_p = smtplib.SMTP() 阅读全文

posted @ 2020-04-02 16:59 不要挡着我晒太阳 阅读(342) 评论(0) 推荐(0) 编辑

python chardet 模块

摘要: 兴高采烈地,从网页上抓取一段 content 但是,一 print 就不那么兴高采烈了,结果看到一串这个: b'\xc8\xcb\xc9\xfa\xbf\xe0\xb6\xcc\xa3\xac\xce\xd2\xd3\xc3Python' 这是啥? 又 x 又 c 的! 再一看,哦,原来是十六进制字 阅读全文

posted @ 2020-04-02 13:43 不要挡着我晒太阳 阅读(563) 评论(0) 推荐(0) 编辑

python pretty-errors模块

摘要: 一行代码优化输出的异常信息 pip install pretty-errors 写一个函数测试: def divided_zero(): for i in range(10, -1, -1): print(10/i) divided_zero() 在没有import这个pretty-errors前, 阅读全文

posted @ 2020-04-02 13:07 不要挡着我晒太阳 阅读(968) 评论(0) 推荐(1) 编辑

认识执行时机

摘要: array = [1, 3, 5] g = (x for x in array if array.count(x) > 0) g为生成器,list(g)后返回[1,3,5],因为每个元素肯定至少都出现一次。所以这个结果这不足为奇。但是,请看下例: array = [1, 3, 5] g = (x f 阅读全文

posted @ 2020-04-02 12:59 不要挡着我晒太阳 阅读(192) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页

导航