error is when http://127.0.0.1:8000/about Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/about Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
The current path, about, didn’t match any of these.
You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
projets
mysite urls.py
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('mainapp.urls')),
]
main app urls.py
from django.urls import path,include
from . import views
urlpatterns = [
path('',views.home),
path('about',views.about),
path('contact',views.contact)
]
views.py
from django.shortcuts import render,HttpResponse
def home(request):
return render(request,"index.html")
def about(request):
return render(request,"about.html")
def contact(request):
return render(request,"contact.html")
templates/about.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document1</title>
</head>
<body>
<h1>Mahabir pun</h1>
<p>he is a great person he is a doing grat</p>
</body>
how to solve please help me i am in trouble for 2 days