how to check DEBUG true/false in django template – exactly in layout.html [duplicate]

In newer versions of Django it is possible just by specifying INTERNAL_IPS in settings.

For example:

INTERNAL_IPS = (
    '127.0.0.1',
    '192.168.1.23',
)

and then in template just:

{% if debug %}

because context processors responsible for that by default, and the answers from How to check the TEMPLATE_DEBUG flag in a django template? are bit deprecated.

Leave a Comment