python规范化(python WSGI规范是什么)
导读:1、WSGI协议规定,Application端需要成为可调用目标(函数、类别等 。 defsimple_app(environ,start_response :...
1 、WSGI协议规定 ,Application端需要成为可调用目标(函数 、类别等) 。
defsimple_app(environ,start_response): status=200OK response_headers=[(Content-type,text/plain)] start_response(status,response_headers) return[Helloworld!\n]2 、Server端也使用函数来实现 。
importos defwsgi_server(application): environ=dict(os.environ.items()) defstart_response(status,response_headers): print(fstatus:{status}) print(fresponse_headers:{response_headers}) result=application(environ,start_response) fordatainresult: print(fresponse_body:{data})以上就是python WSGI规范的介绍 ,希望对大家有所帮助。更多编程基础知识学习:python学习网
创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!