摘要: 这是我自己理解并自己画的,django 请求示意图,表示了它的组织方式。 project manage.py: 主要工具文件 settings.py: 配置文件 urls.py: url 定义及其指向文件 wsgi.py 文件 App views.py: url 对应函数 models.py: DB 阅读全文
posted @ 2016-01-29 16:25 道以万计 阅读(424) 评论(0) 推荐(0) 编辑
摘要: Required: httpd: 2.4.18 django : 1.8.7 mysql: 5.7.10 MySQL-python: 1.2.3 mod_wsgi: 4.4.21 Offical Docs: http://httpd.apache.org/docs/2.4/ https://docs 阅读全文
posted @ 2016-01-29 15:04 道以万计 阅读(630) 评论(0) 推荐(0) 编辑
摘要: 1. 字符串连接 2. 字符串替换 3. 字符串反转 4. 编码 5. 拆分 6. 格式化 %s 字符串 (采用str()的显示) %r 字符串 (采用repr()的显示) %c 单个字符 %b 二进制整数 %d 十进制整数 %i 十进制整数 %o 八进制整数 %x 十六进制整数 %e 指数 (基底 阅读全文
posted @ 2015-12-23 14:41 道以万计 阅读(399) 评论(0) 推荐(0) 编辑
摘要: python 中 time 有三种格式: float, struct tuple(time.struct_time 或 datetime.datetime), str 常用的: float --> struct tuple: time.localtime( float ) struct time t 阅读全文
posted @ 2015-12-21 15:51 道以万计 阅读(101211) 评论(0) 推荐(4) 编辑
摘要: 使用命令行(ssh)对Gerrit进行查询, 官方地址:https://review.openstack.org/Documentation/cmd-query.html程序例子import os, jsondef get_patch_info(GERRIT_HOME, patch_id): ... 阅读全文
posted @ 2015-12-18 14:25 道以万计 阅读(4201) 评论(0) 推荐(0) 编辑
摘要: 下载地址:http://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz 说明:这个版本使用python 2.7比较好。 install: 解压缩,然后运行python setup.p 阅读全文
posted @ 2015-12-15 17:48 道以万计 阅读(4567) 评论(0) 推荐(0) 编辑
摘要: 使用basic auth 的3种方式 1. 设置header 2. 使用 HTTPBasicAuthHandler, 并install。执行认证一次,可以多次访问 3. 含有身份验证的网页,无论是 http 还是 https, 以下代码均适用。(如果还是报权限问题,有可能是 header 问题。) 阅读全文
posted @ 2015-12-15 15:30 道以万计 阅读(674) 评论(0) 推荐(0) 编辑
摘要: 以下使用的module都是系统自带的,无需额外安装。 python2.7 和 python3 都可以使用: 1. import subprocess def execute_cmd(cmd): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, std 阅读全文
posted @ 2015-12-14 14:12 道以万计 阅读(22778) 评论(0) 推荐(2) 编辑
摘要: 装饰器函数:def function_wrapper(wrapped): def _wrapper(*args, **kwargs): return wrapped(*args, **kwargs)return _wrapper@function_wrapperdef funct... 阅读全文
posted @ 2015-12-11 13:31 道以万计 阅读(223) 评论(0) 推荐(0) 编辑
摘要: _xxx 不能用'from module import *'导入__xxx__ 系统定义名字__xxx 类中的私有变量名核心风格:避免用下划线作为变量名的开始。"单下划线" 开始的成员变量叫做保护变量,意思是只有类对象和子类对象自己能访问到这些变量;如果修改,无需通知外部。"双下划线" 开始的是私有... 阅读全文
posted @ 2015-12-10 15:02 道以万计 阅读(6914) 评论(0) 推荐(0) 编辑