Created
February 10, 2021 17:03
-
-
Save dest81/6e25a49cc550ab1e7f6e23786128cc70 to your computer and use it in GitHub Desktop.
Number of queries in django
This file contains 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
from django.conf import settings | |
settings.DEBUG = True | |
from django.db import connection, reset_queries | |
def num_queries(reset=True): | |
print(len(connection.queries)) | |
if reset: | |
reset_queries() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment