Reputation: 1479
I am following a tutorial found in the Django documentation and upon attempting to map a view to a URL I received the following error:
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'pollSite.urls' d
oes not appear to have any patterns in it. If you see valid patterns in the file th
en the issue is probably caused by a circular import
. I have a pollSite
project and a poll
app.
pollSite/pollSite/urls.py:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('polls/', include('polls.urls')),
]
pollSite/poll:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
views.py:
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world")
I thought I may have mistyped something so I went back and copied the code from the docs and pasted it directly into my editor and still got the same error. I'm not sure what a circular import
is but I am also working with virtualenv
for the first time and am not sure if that could be causing this. Any suggestions?
Tutorial incase anyone was interested: https://docs.djangoproject.com/en/2.2/intro/tutorial01/
Upvotes: 0
Views: 104
Reputation: 599630
Your app is called "poll", not "polls". So you have to include it by that name:
path('polls/', include('poll.urls')),
Upvotes: 1