Trying to trace a circular import error in Django

后端 未结 10 2036
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 09:00

I understand circular import error has been asked about a lot but after going through these questions I haven\'t been able to solve my issue. When I try to run my server in Djan

10条回答
  •  既然无缘
    2021-02-05 09:35

    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 '' 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'),
    ]
    

提交回复
热议问题