I asked a question and provided all the relevant code. How could make this Django logging middleware more efficient? After one comment I asked what they wanted to see but people just closed it.

My code sample is all the relevant code. It is actually a live project which works. Please advise me what I should have done differently?


1 Answer 1


... someone just closed it.

Closing a question on Code Review takes 5 votes from members of the community that have more than 3000 rep points. This makes the closure a community decision. Only a moderator can close a question with one vote and that is usually rare. Once the question is edited it is entered into a reopen vote queue and will need at least 3 votes to reopen the question.

Efficiency of code is definitely on topic, but while the object and its 2 methods may be very efficient how the functions are called may not be. Did you have to add any hooks to Django to call these functions? How is the code executed? Is get_response part of the Django framework (CMS) or was it written in another part of the middle ware? I believe that is one of the functions that access the database but I can't be sure. Context of how code is used is very important when talking about efficiency.

You have already asked one question that has never been answered. This is another question that may go unanswered because there is not enough context for us to provide an answer.

  • \$\begingroup\$ Comments about this answer are currently in the 2nd Monitor. The basic gist is that the 5 people that voted to close the original question didn't know Django and that was a problem. \$\endgroup\$
    – pacmaninbw Mod
    Commented Apr 26, 2021 at 15:38
  • \$\begingroup\$ From the 2nd Monitor: >So "is this a Django thing" being part of why it might be closed tells me that the CV's were misplaced. I'm not saying that anyone is a bad person or anything (so don't take my DV on the Meta post personally, @pacmaninbw), but I do think that is perhaps the worst factor to consider. \$\endgroup\$
    – pacmaninbw Mod
    Commented Apr 26, 2021 at 15:39
  • \$\begingroup\$ For reference; the comments @pacmaninbw is talking about can be found here. \$\endgroup\$
    – Peilonrayz Mod
    Commented Apr 26, 2021 at 17:08
  • 1
    \$\begingroup\$ Thanks for your answer. Yes this is a Django thing, actually this is everything that is required to write a Django middleware. I am a little disappointed seeing that I come here to get my code reviewed by people who are way more experienced and smarter than me, just to see it closed because 5 people (I supposed one as I hoped for a single point of failure) in the community (probably) didn't know the framework. \$\endgroup\$
    – creyD
    Commented Apr 27, 2021 at 9:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .