how to check DEBUG true/false in django template - exactly in layout.html
This video explains
how to check DEBUG true/false in django template - exactly in layout.html
--
Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Drifting Through My Dreams
--
Chapters
00:00 Question
00:48 Accepted answer (Score 78)
01:22 Thank you
--
Full question
https://stackoverflow.com/questions/2578...
Question links:
[answer]: https://stackoverflow.com/questions/1271...
[the one using custom template tag]: https://stackoverflow.com/questions/1271...
Accepted answer links:
[INTERNAL_IPS]: https://docs.djangoproject.com/en/2.1/re...
[How to check the TEMPLATE_DEBUG flag in a django template?]: https://stackoverflow.com/questions/1271...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangotemplates #djangosettings
#avk47
how to check DEBUG true/false in django template - exactly in layout.html
--
Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Drifting Through My Dreams
--
Chapters
00:00 Question
00:48 Accepted answer (Score 78)
01:22 Thank you
--
Full question
https://stackoverflow.com/questions/2578...
Question links:
[answer]: https://stackoverflow.com/questions/1271...
[the one using custom template tag]: https://stackoverflow.com/questions/1271...
Accepted answer links:
[INTERNAL_IPS]: https://docs.djangoproject.com/en/2.1/re...
[How to check the TEMPLATE_DEBUG flag in a django template?]: https://stackoverflow.com/questions/1271...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangotemplates #djangosettings
#avk47
ACCEPTED ANSWER
Score 86
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.