摘要: ```python class View: _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = super(View, cls).__new__(cls) return cls._ins... 阅读全文
posted @ 2017-10-11 12:44 sawyer_aquarius 阅读(94) 评论(0) 推荐(0) 编辑
摘要: ```python import logging logging.basicConfig( level=logging.DEBUG, format='[%(asctime)s ] [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S', # 日志输出到文件,文件名字可以自定义 # filename... 阅读全文
posted @ 2017-05-29 21:38 sawyer_aquarius 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 参考:http://docs.pythontab.com/interpy/c_extensions/ctypes/ Python中的ctypes模块可能是Python调用C方法中最简单的一种。ctypes模块提供了和C语言兼容的数据类型和函数来加载dll文件,因此在调用时不需对源文件做任何的修改。也 阅读全文
posted @ 2017-05-29 13:08 sawyer_aquarius 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 参考:http://docs.pythontab.com/ 实现该类的单例模式,使用装饰器的方法。装饰器实现单例模式的方法如下 输出的结果 python2.7 \ 4 \ 6 \ 35090992 35090992 阅读全文
posted @ 2017-05-29 10:55 sawyer_aquarius 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Django admin的设置 1.setting.py配置 创建数据库djangoproject 创建admin超级管理员 登录 阅读全文
posted @ 2017-05-29 00:10 sawyer_aquarius 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 项目创建 创建后的目录截图如下 urls.py设定 写一个小视图模板进行测试 app_user:view.py 编写视图,构建上下文,生成html网页,设定cookie值 修改搜索的模板路径 启动测试服务器 浏览器运行的结果 第一篇,写完了,后续会继续更新。欢迎大家批评指正。 阅读全文
posted @ 2017-05-28 23:39 sawyer_aquarius 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 单例模式 阅读全文
posted @ 2017-05-28 18:21 sawyer_aquarius 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2017-05-28 00:03 sawyer_aquarius 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2017-05-27 23:21 sawyer_aquarius 阅读(92) 评论(0) 推荐(0) 编辑
摘要: NAME=100 定义局部变量 export NAME=100 定义环境变量 unset NAME 清除变量 echo 查看字符串 env 查看环境变量 $() ...`` $((NAME+10)) $[2#10+7] \:转义 阅读全文
posted @ 2017-05-26 09:43 sawyer_aquarius 阅读(75) 评论(0) 推荐(0) 编辑