MCPcopy
hub / github.com/django/django / debug

Function debug

django/template/context_processors.py:38–57  ·  view source on GitHub ↗

Return context variables helpful for debugging.

(request)

Source from the content-addressed store, hash-verified

36
37
38def debug(request):
39 """
40 Return context variables helpful for debugging.
41 """
42 context_extras = {}
43 if settings.DEBUG and request.META.get("REMOTE_ADDR") in settings.INTERNAL_IPS:
44 context_extras["debug"] = True
45 from django.db import connections
46
47 # Return a lazy reference that computes connection.queries on access,
48 # to ensure it contains queries triggered after this function runs.
49 context_extras["sql_queries"] = lazy(
50 lambda: list(
51 itertools.chain.from_iterable(
52 connections[x].queries for x in connections
53 )
54 ),
55 list,
56 )
57 return context_extras
58
59
60def i18n(request):

Callers

nothing calls this directly

Calls 2

lazyFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected