解决If you see valid patterns in the file then the issue is probably caused by a circular import

ImproperlyConfigured: The included urlconf '<module 'xx.urls' from './xx/urls.pyc'>' 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.

以上就是报错信息,原因是一级urls里写着:

url(r'^xx/', include('xx.urls')),

但进入xx目录里后的二级urls文件里却是空的或者全部都注释掉的,就会导致以上报错。所以解决办法是,要么删掉一级urls里的这行,或者填充二级urls里的内容。
而更有意思的是,此问题在postman插件下测试某一个api的url无报错,直接在浏览器上测试就会报错(前端搭建在nginx上)。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章