from django.db import connection from django.template import Template, Context class SQLLogMiddleware: def process_response ( self, request, response ): t = Template('''