首页 > 解决方案 > 所有错误都会导致 URLconf 循环导入

问题描述

我的 django 应用程序中的任何错误都会导致:

The included URLconf 'appname.urls' does not appear to have any 
patterns in it. If you see valid patterns in the file then the issue 
is probably caused by a circular import.

在 pdb 中逐步执行时,我意识到我的应用程序中发生的任何错误都会导致 URLconf 错误。pdb 将显示实际发生的错误,但如果我继续,控制台将仅打印上面显示的 URLconf 错误。如果我去修复 pdb 显示的错误,例如我解决的 SyntaxError,那么一切正常。似乎任何错误我只是导致上面显示的 URLconf 错误,我不确定如何解决它,以便我可以在不通过 pdb 的情况下看到实际错误。

更新:我使用的是 Python 3.5.2,升级到最新的 Python 3.6.9 已修复该错误。

标签: pythondjango

解决方案


我使用的是 Python 3.5.2,经过更多搜索后,它看起来像是一个 Python 问题。升级到 Python 3.6.9 解决了这个问题。


推荐阅读