1
votes

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

2
Your error message doesn't have the patterns that are tried by Django, that's weird!!!JPG

2 Answers

1
votes

Have you added 'mainapp' to 'INSTALLED_APPS' in your project's 'settings.py'?

0
votes

try adding the slashes

path('about/',views.about),
path('contact/',views.contact)

and then you can try

http://127.0.0.1:8000/about/