V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2014-11-26 20:11:03 +08:00 · 5371 次点击
    这是一个创建于 3432 天前的主题,其中的信息可能已经有所发展或是发生改变。
    9 条回复    2014-12-01 17:03:21 +08:00
    est
        1
    est  
       2014-11-26 20:33:39 +08:00
    我来写。
    est
        2
    est  
       2014-11-26 20:36:18 +08:00   ❤️ 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
       2014-11-27 10:23:19 +08:00
    @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  
       2014-11-27 14:20:20 +08:00
    刚好在看这个 PEP333 太长细节太多 推荐看看

    http://wsgi.readthedocs.org/en/latest/learn.html
    1989922yan
        5
    1989922yan  
    OP
       2014-11-27 15:33:23 +08:00
    @irainy
    @est

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

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

    我看看哈
    ryd994
        7
    ryd994  
       2014-11-27 21:46:00 +08:00 via Android
    @1989922yan 就和bt协议,utp,还有utorrent之间的关系类似。
    wsgi是通用协议。uwsgi是一个软件,用来跑wsgi应用。uwsgi协议是uwsgi搞出来的一套协议,所以同名
    irainy
        8
    irainy  
       2014-11-27 23:54:20 +08:00
    @1989922yan 哈哈 我也是因为看werkzeug才去了解wsgi的
    1989922yan
        9
    1989922yan  
    OP
       2014-12-01 17:03:21 +08:00
    @irainy

    哈哈,werkzeug是工具集合,可以构建框架
    我看这个是因为open erp的源码了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2797 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 05:54 · PVG 13:54 · LAX 22:54 · JFK 01:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.