View all Object in Django Template

Question:

In this django function

def request(request):
    args = {"name": "name", 'message': "message"}
    return render(request, 'request.html', args)

the template will get {{name}} and {{message}} variable…
But apart from these two variable one can also access {{user}} and {{LANGUAGES}} object on template which are set in RequestContext by middleware.

Is there a way to displayed/render every object/variable that are sent to template either by my custom response or by any middleware like IP Address of requesting client, and other information.

Asked By: Kuldeep Rishi

||

Answers:

You can use the debug tag:

{% debug %}
Answered By: Nigel Tufnel

You can get all variables and obj using debug

{% debug %}
Answered By: Irshadmi4

If you want to print this vars for debugging only, try django debug toolbar

Answered By: ndpu
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.