解決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上)。

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