Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Numbers following Django's HTTP Response Code

Tags:

python

django

I'm currently working on an existing Django project which runs rather slowly (I assume it's mostly due to the AJAX calls). However, in order to prioritize optimization, I'd like to know what the numbers behind the HTTP Response codes mean.

[03/Dec/2011 22:25:00] "GET /userbase HTTP/1.1" 200 5914 <--This number
[03/Dec/2011 22:25:39] "GET /cohorts?weekly=true HTTP/1.1" 200 27985 <--This too
[03/Dec/2011 22:26:13] "GET /cohorts?weekly=false HTTP/1.1" 200 11416 <--and this one

Since the ones that take longer have larger numbers, I assume it's how long it takes to get a response. But how is this measured? In milliseconds? Clarification would be appreciated.

like image 897
Edwin Avatar asked Dec 04 '11 03:12

Edwin


People also ask

What is HTTP response in Django?

HttpResponse (source code) provides an inbound HTTP request to a Django web application with a text response. This class is most frequently used as a return object from a Django view.

What does status from rest framework is used for?

REST framework includes a set of named constants that you can use to make your code more obvious and readable. The full set of HTTP status codes included in the status module is listed below. The module also includes a set of helper functions for testing if a status code is in a given range.

Which status code is not an indicator of a client error?

403 (Forbidden) A 403 response is not a case of insufficient client credentials; that would be 401 (“Unauthorized”). Authentication will not help, and the request SHOULD NOT be repeated.


1 Answers

Those are the size of the response in bytes. The longer ones are probably larger responses that take longer to calculate. Unfortunately, the output doesn't show time elapsed for requests, though I believe there was a feature request with that at one point.

If you're concerned about how long your requests are taking to complete, you might want to look into installing django-extensions and using the RunProfileServer to build a report.

https://github.com/django-extensions/django-extensions

http://packages.python.org/django-extensions/runprofileserver.html

If you need more comprehensive production logging, check out django-sentry.

https://github.com/django-extensions/django-extensions

like image 158
Paul McMillan Avatar answered Sep 21 '22 18:09

Paul McMillan