python – 来自django runserver的特定日志输出来自何处

我正在学习如何登录python,所以我试图找到源代码中的哪个部分来格式化该行的特定输出:“GET / dashboard / HTTP / 1.1”200 249176?另外,249176是什么意思?

我没有问题,这个问题是为了满足我的好奇心.

我真的在寻找这个logrecord的格式化程序.我也没有看到它来自哪个loghandler(也许这根本不是来自日志记录模块,它只是一个打印命令).我搜索了源代码,无法找到它的来源,并希望有一个链接到源代码.

以下是我运行代码时会发生的情况.

September 05,2013 - 05:38:50
Django version 1.5.1,using settings 'dapi.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[05/Sep/2013 05:38:57] "GET /dashboard/ HTTP/1.1" 200 249176
[05/Sep/2013 05:38:58] "GET /static/plugins/uniform/css/uniform.default.css HTTP/1.1" 304 0
[05/Sep/2013 05:38:58] "GET /static/plugins/bootstrap-daterangepicker/daterangepicker.css HTTP/1.1" 304 0
最佳答案
此数字是响应内容长度,换句话说:发送的字节数.

这个输出基本上来自wsgirefsimple_server(它基于BaseHTTPServer)django内部使用(source).

log_request()函数实际上记录了引擎盖下的代码内容大小:

log_request([code[,size]])

Logs an accepted (successful) request.
code should specify the numeric HTTP code associated with the
response. If a size of the response is available,then it should be
passed as the size parameter.

如果您有兴趣,请查看BaseHTTPServer pypy实现:https://bitbucket.org/pypy/pypy/src/9d88b4875d6e/lib-python/2.7/BaseHTTPServer.py

也可以看看:

> What’s the meaning of the default output of manage.py runserver?

相关文章

我最近重新拾起了计算机视觉,借助Python的opencv还有face_r...
说到Pooling,相信学习过CNN的朋友们都不会感到陌生。Poolin...
记得大一学Python的时候,有一个题目是判断一个数是否是复数...
文章目录 3 直方图Histogramplot1. 基本直方图的绘制 Basic ...
文章目录 5 小提琴图Violinplot1. 基础小提琴图绘制 Basic v...
文章目录 4 核密度图Densityplot1. 基础核密度图绘制 Basic ...