gpt4 book ai didi

python - 如何调试 "Exception while resolving variable in template ' 未知'”?

转载 作者:太空狗 更新时间:2023-10-29 21:11:49 28 4
gpt4 key购买 nike

我一直在看

DEBUG Exception while resolving variable 'exception_type' in template 'unknown'.

在我的 django 日志中,然后是

VariableDoesNotExist: Failed lookup for key [exception_type] in

后跟看起来像是包含请求的字典列表的字符串表示形式,以及我的整个 settings.py 文件。

另一个例子:

DEBUG Exception while resolving variable 'lastframe' in template 'unknown'

我觉得我只是没有足够的信息来调试它。我所知道的是未知模板中有一个名为 exception_type 的变量。我的代码在任何地方都不包含字符串“exception_type”。

我该如何调试它?我应该看哪里?

  • Ubuntu 14.04
  • python 2.7.6
  • Django 1.11

最佳答案

重点不是变量 lastframe 或变量 exception_type 你必须检查你的 url,所有的 url,不仅仅是后端 url,还有前端网址。检查前端 url 和中间件(如果您编写自己的中间件文件,最好的检查方法是在您的 url 上测试 admin)。我遇到了同样的问题,当我检查 url 和中间件时,我很容易解决了这个问题。

关于python - 如何调试 "Exception while resolving variable in template ' 未知'”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43663877/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com