エラー:django.core.exceptions.ImproperlyConfigured: The included URLconf '***.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.
django.core.exceptions.ImproperlyConfigured: The included URLconf '***.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.
djangoのエラーでa circular import.と表示されることがよくある。このエラーパターンの原因をメモしておく。
大抵このエラーはurls.pyに不適切なコードが書かれていると表示される。
urlpatterns = [ url('', TemplateView.as_view(template_name="diary/home.html"), name="home"), ]
上記のようにurlpatternsに含める要素はpath(***)である。しかしurl(***)と書いてしまうとエラーが出る。これはconfig.urls.pyよりもアプリケーション側で起こすことが多い。(なぜならconfig側ならadminの例があるのでpathと書く動機になるが、アプリ側はurls.pyをゼロから作り自分で書いてるとミスを起こす確率が高いから)
...apps/views.pyにて from django.core.pagenator import Paginator, Page, PageNotAnInteger
ずっとurls.pyにエラーが有るはずだと考えるとこのミスに気づけない。
上記の例はページネーション関係のクラスをimportする際に記述ミスしている。from django.core.paginator にしないとエラーが出てしまう。