Where does this particular log exit from the django server work from

I learn about python input, so I'm trying to figure out where in the source code there is a part for formatting the string when you get this particular output: "GET /dashboard/ HTTP/1.1" 200 249176 ? Also, what does 249176 mean?

I have no problems, and this question should satisfy my curiosity.

I am really looking for a formatter for this logrecord. I also do not see why this is happening (because of this, it does not come from the logging module, and this is just a print command). I was looking for the source code and could not find where this came from, and would like to have a link to the source.

This is what happens when I run my code.

 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 
+4
source share
1 answer

This number represents the length of the response content, in other words: the number of bytes sent.

This output mainly comes from wsgiref simple_server (and it is based on BaseHTTPServer ), which django uses internally ( source ).

The log_request () function actually registers the code and the size of the content under the hood:

log_request ([code [, size]])

Logs a received (successful) request. The code should indicate the numeric HTTP code associated with the response. If the response size is available, then it should be as a size parameter.

If you're interested, take a look at BaseHTTPServer implementation: https://bitbucket.org/pypy/pypy/src/9d88b4875d6e/lib-python/2.7/BaseHTTPServer.py

See also:

+4
source

Source: https://habr.com/ru/post/1500706/


All Articles