How do I get all the variables defined in a Django template?

前端 未结 4 960
有刺的猬
有刺的猬 2021-01-30 12:51

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()<

4条回答
  •  梦如初夏
    2021-01-30 13:27

    You might also be interested in django-template-repl, a readline shell for the Django template language. You can drop a {% load repl %}{% pdb %} into your template and get an interactive debugger.

提交回复
热议问题