Created
August 23, 2018 17:45
-
-
Save markscottwright/8b1090b6a8c989eae10bca15df6d2931 to your computer and use it in GitHub Desktop.
How to log SQL in Django Unit Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from django.conf import settings | |
logging.getLogger('django.db.backends').setLevel(logging.DEBUG) | |
logging.getLogger('django.db.backends').addHandler(logging.StreamHandler()) | |
settings.DEBUG = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment