does not appear to have any patterns in it. or circular import

Question:

recently i started to studying django but there is a problem into my code and i cant find what exactly could be a decent fix to this problem so i thought i would be good to ask.

from django.urls import path
from . import views

ulrpatterns = [
    path('' , views.index)

]

well this is my code for urls.py into the articles directory.

from django.contrib import admin
from django.urls import path , include
from home import views as home_views
 urlpatterns = [
    path("" ,home_views.index ),
    path("about", home_views.about),
    path("Contact" ,home_views.contact ),
    path('admin/', admin.site.urls),
    path('articles/' , include('articles.urls')),
]


this one is my main urls.py from what im seeing i called articles.urls but when im running my server it keeps givin me this error

raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
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.

Asked By: navidabasi

||

Answers:

ulrpatterns = [
    path('' , views.index)

Django wants to see the urlpatterns in the urls.py file. You cannot rename it.

Answered By: Matthew Gaiser

I had the same error when I was doing this crash course Django project. I found at least 50% errors were made by TYPO 😉

from django.urls import path
from . import views

**ulrpatterns** = [
    path('' , views.index)
]

change this variable to ‘urlpatterns’, done.

Answered By: wayne39
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.