51Testing软件测试论坛

标题: django报错The included URLconf does not appear to have any patterns in it. [打印本页]

作者: bling123    时间: 2021-2-5 11:24
标题: django报错The included URLconf does not appear to have any patterns in it.
django.core.exceptions.ImproperlyConfigured: The included URLconf 'testDjango.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.
工程架构:
[attach]132103[/attach]

setting.py中配置
[attach]132104[/attach]
主程序testDjango/testDjango/urls.py中路由配置:
[attach]132105[/attach]
应用testDjango/App/urls.py中路由配置:
[attach]132106[/attach]
views.py内容:
[attach]132107[/attach]

执行程序报错:
django.core.exceptions.ImproperlyConfigured: The included URLconf 'testDjango.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.

作者: qqq911    时间: 2021-2-5 11:41
主程序testDjango/testDjango/urls.py中路由配置 ,用path,在加上namespace,试试。
作者: bling123    时间: 2021-2-5 14:24
qqq911 发表于 2021-2-5 11:41
主程序testDjango/testDjango/urls.py中路由配置 ,用path,在加上namespace,试试。

试过了,还是同样报错

    path('app/', include('app.urls',namespace='app')),
作者: bling123    时间: 2021-2-5 16:09
问题已经解决,是我之前不小心将主程序testDjango/testDjango/urls.py,这个urls.py手工删除掉了,然后自己又手工建了这个文件,后来我重新将整个项目删除掉,重新创建django项目,就好了,具体不清楚什么原因。
作者: litingting0214    时间: 2021-2-5 16:47
解决了就好 赞
作者: 郭小贱    时间: 2021-2-5 17:02
学习了。
作者: jingzizx    时间: 2021-2-7 07:24





欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2