Django Show the Raw SQL Query Running

To see the raw SQL queries Django is running, do the following:
In your settings file (typically settings.py), ensure DEBUG is set to True
Python
DEBUG = TrueThen import connection from django.db and print connection.queries
Python
from django.db import connection from pprint import pprint pprint(connection.queries)
If your queries are slowing you down, look into using select_related() to follow foreign keys