python
文章平均质量分 78
zs_2014
这个作者很懒,什么都没留下…
展开
-
gunicorn配置文件
工作中使用gunicorn作为服务器的原创 2014-11-18 16:54:57 · 15672 阅读 · 1 评论 -
python generator
近期看了tornado的源码,gen模块使用yield实现了coroutine(协程),一个函数中一旦使用了yield语句,那么这个函数可以说就是个generator了。example 1: 1 #coding: utf-8 2 def gen1(): 3 print 'hi, this is in the gen1 generator' 4 yield 1原创 2015-04-18 19:55:48 · 530 阅读 · 0 评论 -
python decorator
python中decorator使用形式基本上分为两种:1. | 2.@dec_no_arguments | @dec_with_arguments(arg)def f(*args, **kwargs): | def原创 2015-04-19 13:59:46 · 640 阅读 · 1 评论 -
python logging的学习
python中的logging模块提供了日志功能,官网document链接:https://docs.python.org/2/library/logging.html.python 的logging系统主要元素有四个:分别是logger,handler, filter,formatter. logger可以提供对日志消息做初步的处理(初步处理指的是对日志消息level的检查和使用logge原创 2015-05-09 11:11:12 · 982 阅读 · 0 评论 -
python loggingconfig.dictConfig
python中logging.config.dictConfig函数可以方便的配置自己所需要的日志系统,其官方document链接为:https://docs.python.org/2/library/logging.config.html。对于使用dictConfig函数,最难的莫非dictConfig需要的参数该如何配置了。通用的配置结构如下。{'version': must,其值原创 2015-05-09 16:19:45 · 10041 阅读 · 0 评论 -
python 导入挂起
公司python后端需要将server换成gunicorn的gevent模式,但是系统启动的时候,总是在一个文件中挂起,import 根本无法完成,查了一下原因,竟然是导入挂起。公司使用到了mongo,并且使用的是conn_write = pymongo.MongoReplicaSetClient(MONGO_SERVER['master'], replicaSet=MONGO_SERVER[原创 2014-11-27 10:36:49 · 558 阅读 · 0 评论 -
python greenlet
greenlet是python的一个高性能的协程库,其底层用C实现.一个greenlet对象就代表一个协程.example1:#coding: utf-8import greenlet#coding: utf-8import greenletdef test(name): print 'this is in the test: name=%s' % namegr原创 2015-06-02 15:38:08 · 780 阅读 · 0 评论