[Solved]-Got The included URLconf does not appear to have any patterns in it

15👍

One defines the list of url patterns in a variable named urlpatterns, not urls, as is specified in the documentation on URL dispatching [Django-doc]:

(…)

Django loads that Python module and looks for the variable urlpatterns. This should be a Python list of django.urls.path() and/or django.urls.re_path() instances.

(…)

So the system thus raises an error that you appear to have forgotton something. You can fix it by renaming urls to urlpatterns:

# account/urls.py

from django.contrib.auth import views
from . import views

urlpatterns = [
    path('login/', views.user_login, name='login'),
]

4👍

If your urls.py imports a class-based view that uses reverse(), you will get this error; using reverse_lazy() will fix it.

0👍

In my case, I had ImproperlyConfigured error due to the fact that I was using the same virtual environment for two projects, executed command

pip install -r requirements.txt

for these two projects. I created new virtual environment and error has gone.

👤Arthur

Leave a comment