[英]How do I get a “debug” variable in my Django template context?
According to this SO post: 根据这篇SO帖子:
How to check the TEMPLATE_DEBUG flag in a django template? 如何检查django模板中的TEMPLATE_DEBUG标志?
if: 如果:
TEMPLATE_CONTEXT_PROCESSORS = ['django.core.context_processors.debug',...
I should have a "debug" variable to my template context. 我的模板上下文应该有一个“debug”变量。 However, I don't: when I do
{{debug}}
in a template, it renders as nothing (""). 但是,我没有:当我在模板中执行
{{debug}}
时,它会呈现为空(“”)。
Is there anything else I'm missing that is necessary to get a "debug" var in the template context? 在模板上下文中获取“debug”var是否还有其他我想要的东西?
您还需要确保请求的IP地址在您的设置中的INTERNAL_IPS
中(您可能没有设置): https : //docs.djangoproject.com/en/2.1/ref/templates/api/#django-模板上下文处理器调试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.