Is there a template tag (or any other trick) that I can use to display all the variables available on the page?
If DEBUG is enabled, there the template tag is called {% debug%}
There are several options (some of them are already listed earlier):
django builtin debug tag - I use this template to display it correctly:
<preliminary> {% filter force_escape%} {% debug%} {% endfilter%} </ preliminary>
Use django template debug application tags, such as attributes, variables and details , or you can set a breakpoint inside the template where you can check everything with the pdb debugger (or ipdb)
Django debug toolbar - has a template bar for this purpose
Usually, all debugging functions work only when the application is in DEBUG .
the debug toolbar does all of this and much, much more. See screencast for more details. If you literally just want variables, you can try
assert False, locals()
in your view
About the advice. Use textarea and automatically select onclick for easy copying:
textarea
onclick
<textarea onclick="this.focus();this.select()" style="width: 100%;"> {% filter force_escape %} {% debug %} {% endfilter %}</textarea>
A slightly more complicated solution with the best rewards is to download the django-debug-toolbar (documentation here )
There is an option “Templates” with another parameter “Switch context”, and you can see all the variables transferred to your template, as well as the ability to see the code behind the template.