Django debug display all variables of a page

后端 未结 6 2035
既然无缘
既然无缘 2020-12-12 19:05

Is there a template tag (or any other trick) I can use to display all the variables available in a page?

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 19:25

    There are several options (some of them already listed before):

    1. django builtin debug tag - I use this boilerplate to display it properly:

        {% filter force_escape %}
        {% debug %}
        {% endfilter %}
           

    2. Use django template debug application's tags like attributes, variables and details or you can even set a breakpoint inside of a template where you can inspect everything with pdb debugger (or ipdb)

    3. Django debug toolbar - has a template panel for this purpose

    Usually all debug features work only when the app is in DEBUG mode.

提交回复
热议问题