推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
1989922yan
V2EX  ›  Python

{WSGI vs uWSGI, 还有 uwsgi}: 能解释\讨论一下区别吗?

  •  
  •   1989922yan · Nov 26, 2014 · 6103 views
    This topic created in 4210 days ago, the information mentioned may be changed or developed.
    9 replies    2014-12-01 17:03:21 +08:00
    est
        1
    est  
       Nov 26, 2014
    我来写。
    est
        2
    est  
       Nov 26, 2014   ❤️ 2
    WSGI。python里只要长得像这个函数的

    def simple_app(environ, start_response):
      response_headers = [('Content-type','text/plain')]
      start_response('200 OK', response_headers)
      return ['Hello world!\n']

    的都叫WSGI。

    uwsgi 是个二进制协议,你理解为比http更高效牛逼功能强大的东西。http可以封装在这个二进制协议里。

    uWSGI是个可以跑起来的进程。这个进程干嘛的呢?就是用来连接python代码WSGI接口,和nginx uwsgi_pass语句之间的那坨东西。
    1989922yan
        3
    1989922yan  
    OP
       Nov 27, 2014
    @est

    跟我昨天的理解有出入,来讨论

    参考:
    http://stackoverflow.com/questions/7739810/wsgi-vs-uwsgi-with-nginx
    http://flask.pocoo.org/docs/0.10/deploying/uwsgi/


    不完整的结论:
    1. WSGI 给出的形式完全正确,我还是不理解这个形式的深层含义,等等我去看 PEP 333. 这个稍后聊聊。
    2. uwsgi 和 uWSGI, 感觉,感觉前者是 一个实际的实现(uwsgi),后者是一个协议(uWSGI)


    @est 来聊聊
    irainy
        4
    irainy  
       Nov 27, 2014
    刚好在看这个 PEP333 太长细节太多 推荐看看

    http://wsgi.readthedocs.org/en/latest/learn.html
    1989922yan
        5
    1989922yan  
    OP
       Nov 27, 2014
    @irainy
    @est

    http://chaoxz2005.blog.163.com/blog/static/15036542012863405266/

    推荐这个,一直了解文档还是不够清楚,
    可以直接完成一个小程序,应该会明白很多
    1989922yan
        6
    1989922yan  
    OP
       Nov 27, 2014
    @irainy

    我看看哈
    ryd994
        7
    ryd994  
       Nov 27, 2014 via Android
    @1989922yan 就和bt协议,utp,还有utorrent之间的关系类似。
    wsgi是通用协议。uwsgi是一个软件,用来跑wsgi应用。uwsgi协议是uwsgi搞出来的一套协议,所以同名
    irainy
        8
    irainy  
       Nov 27, 2014
    @1989922yan 哈哈 我也是因为看werkzeug才去了解wsgi的
    1989922yan
        9
    1989922yan  
    OP
       Dec 1, 2014
    @irainy

    哈哈,werkzeug是工具集合,可以构建框架
    我看这个是因为open erp的源码了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2865 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 05:52 · PVG 13:52 · LAX 22:52 · JFK 01:52
    ♥ Do have faith in what you're doing.