0

How i can determine the number of calls does by my app in one view call. I intent to make a decorator with this intention.

@trace_db_calls
def my_view(request):
     #code
     return HttpResponse('done')

At this moment I am investigating how to do it, regards

Gytree
  • 542
  • 3
  • 13
  • Possible duplicate of [How to show the SQL Django is running](http://stackoverflow.com/questions/1074212/how-to-show-the-sql-django-is-running) – e4c5 May 07 '17 at 03:50

1 Answers1

0

you should look at the django-debug-tool. You can open the django debug shell with command python manage.py debugsqlshell and in shell you can call your function. It'll show all the database queries made.

Also if you are looking for a way to log SQL queries in a file you can look at this middleware. Middleware runs on every request.

badiya
  • 2,247
  • 13
  • 23