【发布时间】:2014-11-05 04:00:49
【问题描述】:
我想根据 DEBUG = True 与否来区分layout.html 中某些工具栏的外观。
我知道 answer 使用 django.core.context_processors.debug 但它迫使我使用 RequestContext 而不是 Request 我不太喜欢,顺便说一句,我怎样才能将 RequestContext 用于 layout.html 扩展 base.html ?
通常有什么比提到的或the one using custom template tag更好的方法吗?
我目前使用的是 Django 1.7
【问题讨论】:
-
这与stackoverflow.com/questions/1271631/… 本质上是同一个问题,答案应该在那个帖子里。 (这个问题的答案也与其他线程中接受的答案基本相同。)
标签: python django django-templates django-settings