您的位置:首页 > 编程语言 > Go语言

Django framework

2016-01-16 13:09 585 查看
1. Django 的内置web server是如何实现的

2. Django 的WSGI是如何实现的

3. Django middle ware是如何实现的

4. Django framework的workflow, 从request 进来到response 出去

5. Django 和数据库的连接,model的工作原理

Django 的 WSGI Server 用的是 wsgiref.simple_server

WSGI APP 是 core.handler.wsgi.wsgihander

WSGIRequest实际上就是一个dict 持有原始request里的数据

WSGIHandler 返回HTTPResponse (所以HTTPResponse也是iterable的, 像list 一样?)

WSGIHandler 会去读 urlconfig找到view,会去读setting,例如middleware的配置

middleware的调用也是在WSGIHandler中

WSGI APP 必须具有下面的接口

def __call__(self, environ, start_response):

start_response is also callable object created by WSGIServer.

WSGI APP will transfer the status and headers to WSGIServer through this callable object.

Also WSGI APP must return a list similar response to WSGIServer.

In the end, WSGIServer will collect the headers and response together and send back to client.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: