Skip to content

Instantly share code, notes, and snippets.

@pixyj
Created October 28, 2012 04:09
Show Gist options
  • Save pixyj/3967466 to your computer and use it in GitHub Desktop.
Save pixyj/3967466 to your computer and use it in GitHub Desktop.
Log Sql queries in Django
#To get all sql queries sent by Django from py shell
import logging
l = logging.getLogger('django.db.backends')
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())
#For more info, http://stackoverflow.com/questions/971667/django-orm-how-to-view-or-log-the-executed-query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment