Skip to content

Instantly share code, notes, and snippets.

View daniestrella1's full-sized avatar
🏠
Working from home

Dani Estrella daniestrella1

🏠
Working from home
  • app2u
  • Universitat de Barcelona
View GitHub Profile
@daniestrella1
daniestrella1 / middleware.py
Created November 13, 2017 22:04 — forked from j4mie/middleware.py
Django middleware to log the total number of queries run and query time for every request
from django.db import connection
import logging
logger = logging.getLogger(__name__)
class QueryCountDebugMiddleware(object):
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It does not currently support