标签:
用来为server程序和app/framework程序做连接桥梁的,使server和app/framework各自发展,任意组合
比如,当server程序启动了tcp进程,当有数据到来,server程序做完它的通用本职后,需要将数据传入到app/framework中。
/* 简化server程序 */ def run_with_cgi(application): environ = dict(os.environ.items()) environ[‘wsgi.input‘] = sys.stdin ....... result = application(environ, start_response) write(result) /* 简化app程序 */ def simple_app(environ, start_response): """Simplest possible application object""" status = ‘200 OK‘ response_headers = [(‘Content-type‘, ‘text/plain‘)] start_response(status, response_headers) return [‘Hello world!\n‘]
https://www.python.org/dev/peps/pep-0333/
标签:
原文地址:http://www.cnblogs.com/johnchow/p/4462466.html