Error message: [09/Jul/2024 20:02:20] "GET /blog/about HTTP/1.1" 404 2285 Not Found: /blog/about geting this while creating Blog app

` # **views.py**
from django.shortcuts import render
from django.http import HttpResponse

def home(request):
    return HttpResponse('<h1>Blog home</h1>')

def about(request):
    return HttpResponse('<h1>Blog About</h1>')
# **urls.py (in blog)**
from django.urls import path
from . import views

urlpatterns = [
    path('', views.home, name='blog-home'),
    path('about/', views.about, name='blog-about'),
]
# **urls.py (in django_project)**
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('blog/', include('blog.urls')),
]

can't get the aboutpage Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/blog/about Using the URLconf defined in django_project.urls, Django tried these URL patterns, in this order:

admin/ blog/ [name='blog-home'] The current path, blog/about, didn’t match any of these.

trying to get the about page but couln't found resulted:Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/blog/about Using the URLconf defined in django_project.urls, Django tried these URL patterns, in this order: admin/ blog/ [name='blog-home'] The current path, blog/about, didn’t match any of these.

Your request URL is http://127.0.0.1:8000/blog/about but according to your URL conf, the correct request URL should have a trailing slash i.e. http://127.0.0.1:8000/blog/about/. As @willeM_ Van Onsem noted in the comments, this should not be an issue if APPEND_SLASH is set to True.

Either add a trailing slash to your request URL or remove the trailing slash in your about URL conf to fix this.

Back to Top