How do I get all the variables defined in a Django template?
问题 I'm new to Django and I wonder if there is a way to dump all the variables available to a template for debugging purposes. In Python I might use something like locals() , is there something equivalent for the default template engine? Note: suppose I don't have access to the view for the purposes of this question. 回答1: Both Ned's and blaine's answers are good, but if you really want to achieve exactly what you ask for there's a template tag for it: {% debug %} Builtins:debug More information