Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Django SQL dump middleware
from django.conf import settings
from django.db import connection
class SqldumpMiddleware(object):
def process_response(self, request, response):
if settings.DEBUG and 'sqldump' in request.GET:
response.content = str(connection.queries)
response['Content-Type'] = 'text/plain'
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.