Get Django SQL Queries on production server
Normally, django does not store queries when settings.DEBUG is turned off. However, since settings is just a python module, you can turn it on in the shell:
$ ./manage.py shell
>>> from django.conf import settings
>>> settings.debug=True
>>> from django.db import connection
>>> # ...
>>> # exec function of interest here
>>> connection.queries
[{u'time': u'0.000', u'sql': u'SELECT ` ...
Written by Chris Vigelius
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#