Hi all. I have started following tutorial 1 Writing your first Django app, part 1 | Django documentation | Django and after completing all of the steps accordingly and trying to go to http://localhost:8000/polls/ I get a 404 error. I am sure I have saved the urls.py in polls app, but it seems like django does not see it and does not check for these urls. Could you please tell me what I am doing wrong?
my urls.py:
from django.contrib import admin
from django.urls import include, path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
For anyone else having this problem, I figured it out. It’s not abundantly clear in the tutorial docs that the mysite/urls.py file you need to add the line to for the polls urlpattern is in the “inner” mysite folder. The error you see indicates that because it’s saying it has only found an admin pattern (by default the inner mysite/urls.py only has that pattern). Most likely you have edited the urls.py file in the “outer” mysite folder. That was my issue anyway, hope that helps others.