This topic is a follow up for another topic of a similar issue:
link: polls app Page not found (404)
@KenWhitesell
It is difficult to know what happens without read your code.
But usually in Django that happens because there is something wrong in your urls.py files.
Make sure you have plugged the polls app in your config.urls.py files, and that there is no misspellings in both urls.py files
This is the dictionary structure:
mysite
|--- manage.py
|--- mysite
|--- settings.py
|--- urls.py
|---__init__.py
|---asgi.py
|---wsgi.py
|--- polls
|--- apps.py
|--- views.py
|--- models.py
|--- urls.py
|--- test.py
|--- admin.py
|---__init__.py
|---migration
The code in mysite/mysite/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
And this is the code under mysite/polls/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
can you the text of your browser with the error?
I mean the error in dev mode in your local machine.
In the future, please don’t post screen images here when copy/pasting the text will do.
Your url definition has:
You need to include the trailing slash in your url you are trying to reference. (Review the text and examples at Writing your first Django app, part 3 | Django documentation | Django)
Thank you sir. It works.