[Django]-Django doesn't create a {{ debug }} variable in DEBUG mode

3👍

In your view, are you creating a Context, or a RequestContext? It needs to be RequestContext.

1👍

Ned Batchelder’s answer led me to the right direction. A RequestContext instance must be explicitly passed when using render_to_response:

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

From Django 1.3, you can use the render function as shorthand:

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

Leave a comment