美文网首页
WSGI servers-wsgiref

WSGI servers-wsgiref

作者: 可爱喵星人 | 来源:发表于2018-03-08 09:05 被阅读0次

WSGI 是一种接口规定,服务器程序 只有实现了这种接口规定,才能和应用端程序(框架)很好的结合。
wsgiref就是一种服务端程序的一种,他在python3 里面内嵌了。

服务端程序

  • 规定:调用应用端程序
  • 应用端处理逻辑概要:
def run(application):
    environ = {}
    def start_response(status, response_headers, exc_info=None):
        pass
    result = application(environ, start_response)
    def write(data):
        pass
    for data in result:
        write(data)
  • 应用端概要
def application(environ,start_response)
      pass
  • 调用概要
run(application)

wsgiref

wsgiref实现了上面 run的功能。wsgiref.simple_server 提供了相关的方法

参考

服务端程序:https://wsgi.readthedocs.io/en/latest/servers.html
wsgiref:https://docs.python.org/3.6/library/wsgiref.html#examples
environ-variables一览:https://www.python.org/dev/peps/pep-0333/#environ-variables

相关文章

  • WSGI servers-wsgiref

    WSGI 是一种接口规定,服务器程序 只有实现了这种接口规定,才能和应用端程序(框架)很好的结合。wsgiref...

  • python wsgi+Odoo 的启动

    参考:WSGI初探Odoo web 机制浅析python的 WSGI 简介python wsgi 简介 wsgi的...

  • wsgi&uwsgi

    WSGI协议 WSGI, aka Web Server Gateway Interface, WSGI 不是服务器...

  • wsgi简介

    wsgi是什么? WSGI:Web Server Gateway Interface。WSGI接口定义非常简单,它...

  • WSGI简介

    结合案例Python部署 & 示例代码wsgi-demo All in One WSGI WSGI = Pytho...

  • gunicorn使用

    WSGI 了解gunicorn之前先了解WSGI WSGI是Python Web Server Gateway I...

  • flask的deamon简单分析

    代码样例 分析所谓的wsgi应用,wsgi应用一定要有call函数。这样最后才能被wsgi调用,并将wsgi应用处...

  • 关于网络的记录

    WSGI等 WSGI是一种通信协议。WSGI将Web组件分成了三类:Web 服务器(WSGI Server)、We...

  • flask源码分析

    wsgi协议 关于wsgi协议就不赘述了,以下是最简单的符合wsgi的应用 app attriabute app....

  • Flask流程

    回顾一下Flask的流程: WSGI Server 到 WSGI App 图中可以看到HTTP请求都是通过WSGI...

网友评论

      本文标题:WSGI servers-wsgiref

      本文链接:https://www.haomeiwen.com/subject/jcssfftx.html