深入理解 Python WSGI:一起写一个 Web 服务器

导读:

本系列深入浅出的讲述了如何用 Python 从 0 开始,写一个 web 服务器,并让其与业界流行的 web 框架协同工作,最后还进一步完善了开头的 web 服务器 demo,让其可以支持多并发请求的处理,并解决了过程当中遇到的“僵尸进程”等一系列 socket/网络编程 中的常见问题,图文并茂、循序渐进,是篇非常不错的教程,对了解整个 Web 编程理论相当有帮助,推荐一看。

作者:伯乐在线 - 高世界 翻译

1、什么是 Web 服务器,以及怎样工作的?

一起写一个 Web 服务器(1)

http://python.jobbole.com/81524/

Let’s Build A Web Server. Part 1.

http://ruslanspivak.com/lsbaws-part1/

2、Web 服务器和 Web 框架如何通过 WSGI 协同工作?

一起写一个 Web 服务器(2)

http://python.jobbole.com/81523/

Let’s Build A Web Server. Part 2.

http://ruslanspivak.com/lsbaws-part2/

3、Web 服务器如何处理并发请求?

一起写一个Web服务器(3)

http://python.jobbole.com/81820/

Let’s Build A Web Server. Part 3.

http://ruslanspivak.com/lsbaws-part3/


4、推荐阅读

[1] Python HOWTO 官方文档:Socket 编程

http://python.jobbole.com/81860/

[2] Python Realtime

http://pyzh.readthedocs.org/en/latest/python-realtime.html

[3] 作为一个python开发者需要知道的关于服务器的知识

http://python.jobbole.com/82009/

[4] 理解Python WSGI

http://www.letiantian.me/2015-09-10-understand-python-wsgi/

[5] 专题:浅入浅出Flask框架

http://www.letiantian.me/topic-learn-flask/


5、关于 wsgi 问题集锦

问题:nginx<--->fstcgi<--->wsgi(flup)<--->web.py/Flask/Django这个模式是nginx和python的web网页的工作模式吗?

    Flup 通常不是生产环境选择,Gunicorn,uwsgi + nginx 和 Tornado 是几种常见方案吧。

[1] nginx<--->fstcgi<--->wsgi(flup)<--->web.py这个模式是nginx和python的web网页的工作模式吗?

http://www.zhihu.com/question/20221856

[2] 全面解读python web 程序的9种部署方式

http://lutaf.com/141.htm

[3] 深入理解 Python WSGI fastcgi

http://www.cnblogs.com/babykick/archive/2012/01/20/2328047.html

[4] 在Mac上使用Nginx和FastCGI部署Flask应用

    http://segmentfault.com/a/1190000002652109

    nginx上用fastcgi配置python环境(一)  

    http://blog.163.com/sky20081816@126/blog/static/1647610232010824262695/

[5] 基于nginx和uWSGI在Ubuntu上部署Django

    http://www.jianshu.com/p/e6ff4a28ab5a

    快速部署Python应用:Nginx+uWSGI配置详解

    http://developer.51cto.com/art/201010/229615_all.htm

[6] 高性能框架gevent和gunicorn在web上的应用及性能测试

    http://rfyiamcool.blog.51cto.com/1030776/1276364

    Gunicorn快速入门

    http://www.cnblogs.com/ArtsCrafts/p/gunicorn.html

[7] gunicorn, uwsgi, fast-cgi, tornado 等等,大家一般都用哪个做 server ?

http://python-china.org/t/100

[8] 在生产系统使用Tornado WebServer来代替FastCGI加速你的Django应用

    http://www.cnblogs.com/Alexander-Lee/archive/2011/05/02/tornado_host_django.html

    Tornado 中文文档

    http://www.tornadoweb.cn/documentation



你可能感兴趣的:(深入理解 Python WSGI:一起写一个 Web 服务器)