Trying to trace a circular import error in Django

for those who have the same error but still hasn't debugged their code, also check how you typed "urlpatterns"

having it mistyped or with dash/underscore will result to the same error


Those habitual with CamelCased names may face the error as well.

urlpatterns has to be typed exactly as 'urlpatterns'

This will show you error -

urlPatterns = [
    path('', views.index, name='index'),

Error -

django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'polls.urls' from '...\\polls\\urls.py'>' 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.

However, fixing the CamelCase will work -

urlpatterns = [
    path('', views.index, name='index'),
]

Try changing

urlpatterns = [
     url(r'^accounts/', include('accounts_app')),
] 

to

urlpatterns = [
     url(r'^accounts/', include('accounts_app.urls')), # add .urls after app name
]