template.context_processors.debug()

debug() [source]

If this processor is enabled, every RequestContext will contain these two variables – but only if your DEBUG setting is set to True and the request’s IP address (request.META['REMOTE_ADDR']) is in the INTERNAL_IPS setting:

  • debugTrue. You can use this in templates to test whether you’re in DEBUG mode.
  • sql_queries – A list of {'sql': ..., 'time': ...} dictionaries, representing every SQL query that has happened so far during the request and how long it took. The list is in order by database alias and then by query. It’s lazily generated on access.
Changed in Django 1.10:

In older versions, only the queries for the default database alias were included.

doc_Django
2016-10-09 18:39:46
Comments
Leave a Comment

Please login to continue.