Django does not create variable {{debug}} in DEBUG mode

As in the documentation, variables called “debug” and “sql_queries” should be used in the templates if all the requirements are met.

I installed the following (and checked their values ​​using the debug toolbar ):

  • DEBUG = True
  • TEMPLATE_DEBUG = True
  • TEMPLATE_CONTEXT_PROCESSORS left by default (containing 'django.core.context_processors.debug')
  • INTERNAL_IPS = ('127.0.0.1',)(and the debug toolbar shows REMOTE_ADDR = '127.0.0.1'in the "HTTP headers" section)
  • TEMPLATE_STRING_IF_INVALID = "(invalid variable '%s'!)"

When rendering a template containing {{ sql_queries }} {{ debug }}, I get (invalid variable 'sql_queries'!) (invalid variable 'debug'!)as output.

My version of Django is 1.2.3. What am I missing here?

+3
source share
2

, Context RequestContext? RequestContext.

+3

. RequestContext render_to_response:

return render_to_response("some.template.file",
                          templateArguments,
                          context_instance = RequestContext(request))

Django 1.3 render :

return render(request, "some.template.file", templateArguments)
+1

Source: https://habr.com/ru/post/1769868/


All Articles