Error 404 following a tutorial 1

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 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?


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

What’s the content of polls.urls file?
Also note that you’re accessing polls and not polls/ (Note the trailing slash / )

In addition to @leandrodesouzadev comment, notice that the error in the browser window is not showing these other urls that you have defined.

I’m guessing the problem is that you made these entries in your polls/ file instead of the mysite/

Review very carefully the steps starting from Writing your first Django app, part 1 | Django documentation | Django. Pay particular attention to which files need to be modified.

1 Like