会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
xybaby
竹杖芒鞋轻胜马,谁怕?一蓑烟雨任平生
博客园
首页
新随笔
联系
管理
订阅
上一页
1
···
6
7
8
9
10
11
下一页
2017年1月20日
gunicorn Arbiter 源码解析
摘要: 如前文所述,Arbiter是gunicorn master进程的核心。Arbiter主要负责管理worker进程,包括启动、监控、杀掉Worker进程;同时,Arbiter在某些信号发生的时候还可以热更新(reload)App应用,或者在线升级gunicorn。Arbiter的核心代码在一个文件里面
阅读全文
posted @ 2017-01-20 09:33 xybaby
阅读(3216)
评论(2)
推荐(0)
2017年1月19日
gunicorn 简介
摘要: gunicorn是一个python Wsgi http server,只支持在Unix系统上运行,来源于Ruby的unicorn项目。Gunicorn使用prefork master-worker模型(在gunicorn中,master被称为arbiter),能够与各种wsgi web框架协作。gu
阅读全文
posted @ 2017-01-19 23:02 xybaby
阅读(49941)
评论(2)
推荐(3)
python bottle 简介
摘要: bottle 是一个轻量级的python web框架, 可以适配各种web服务器,包括python自带的wsgiref(默认),gevent, cherrypy,gunicorn等等。bottle是单文件形式发布,源码在这里可以下载,代码量不多,可以用来学习web框架。这里也有官方文档的中文翻译。
阅读全文
posted @ 2017-01-19 14:14 xybaby
阅读(25524)
评论(1)
推荐(6)
2017年1月18日
python wsgi 简介
摘要: wsgi全称是"Web Server Gateway Interfacfe",web服务器网关接口,wsgi在python2.5中加入,是web服务器和web应用的标准接口,任何实现了该接口的web服务器和web应用都能无缝协作。来看一个形象点的图: 如上图所示(图片来自这里),wsgi一端连接we
阅读全文
posted @ 2017-01-18 22:53 xybaby
阅读(6722)
评论(0)
推荐(2)
2017年1月12日
python __getattr__ 巧妙应用
摘要: 在之前的文章有提到__getattr__函数的作用: 如果属性查找(attribute lookup)在实例以及对应的类中(通过__dict__)失败, 那么会调用到类的__getattr__函数, 如果没有定义这个函数,那么抛出AttributeError异常。由此可见,__getattr__一定
阅读全文
posted @ 2017-01-12 23:35 xybaby
阅读(48656)
评论(0)
推荐(9)
python filter map reduce
摘要: filter(function, iterable): Construct a list from those elements of iterable for which function returns true. 对iterable中的item依次执行function(item),将执行结果为
阅读全文
posted @ 2017-01-12 13:10 xybaby
阅读(1178)
评论(0)
推荐(0)
2017年1月11日
python decorator 进阶
摘要: 上一篇文章开始的时候提到 “一般来说,装饰器是一个函数,接受一个函数(或者类)作为参数,返回值也是也是一个函数(或者参数)” 有一般情况,就有特殊情况。第一种特殊情况:装饰器可能也是一个类;第二种特殊情况:装饰器返回的对象的类型不一定等同于被装饰对象的类型。 对于第一种情况,我们知道对于任何call
阅读全文
posted @ 2017-01-11 21:26 xybaby
阅读(500)
评论(0)
推荐(0)
python decorator 基础
摘要: 一般来说,装饰器是一个函数,接受一个函数(或者类)作为参数,返回值也是也是一个函数(或者类)。首先来看一个简单的例子: 1 # -*- coding: utf-8 -*- 2 def log_cost_time(func): 3 def wrapped(*args, **kwargs): 4 imp
阅读全文
posted @ 2017-01-11 21:24 xybaby
阅读(1935)
评论(0)
推荐(0)
2017年1月10日
python属性查找 深入理解(attribute lookup)
摘要: 在Python中,属性查找(attribute lookup)是比较复杂的,特别是涉及到描述符descriptor的时候。 在上一文章末尾,给出了一段代码,就涉及到descriptor与attribute lookup的问题。而get系列函数(__get__, __getattr__, __geta
阅读全文
posted @ 2017-01-10 19:34 xybaby
阅读(16765)
评论(3)
推荐(11)
2017年1月9日
python descriptor 详解
摘要: descriptor简介 在python中,如果一个新式类定义了__get__, __set__, __delete__方法中的一个或者多个,那么称之为descriptor。descriptor有分为data descriptor与non-data descriptor, descriptor通常用
阅读全文
posted @ 2017-01-09 21:53 xybaby
阅读(6858)
评论(0)
推荐(3)
上一页
1
···
6
7
8
9
10
11
下一页
公告