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

前端之家收集整理的这篇文章主要介绍了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
@H_404_15@
最佳答案@H_404_15@
此数字是响应内容长度,换句话说:发送的字节数.

这个输出基本上来自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?@H_404_15@ 原文链接:https://www.f2er.com/python/439610.html

猜你在找的Python相关文章