404 Page Not Found Issue in Django [closed]
I am encountering a 404 error when trying to access the homepage of my Django application. Here are the details of the error:
Error: Page not found (404) reservation/accueil.html Request details: Request Method: GET Request URL: http://127.0.0.1:8000/ Raised by: reservations.views.accueil URLconf used: In the file gestion_reservations.urls, Django tried to match these URL patterns in this order: --admin/ --accounts/ --[name='accueil'] --The empty path matched the last pattern.
**Context: I am trying to display the accueil.html page in the reservation/ folder, but Django returns a 404 error. My urls.py file for the app seems to be configured correctly, but the page is not loading.
**Here is part of my urls.py code:
from django.urls import path
from . import views
urlpatterns = [
path('', views.accueil, name='accueil'),
# Other paths
]
**And here is the corresponding view in views.py:
from django.shortcuts import render
def accueil(request):
return render(request, 'reservation/accueil.html')
**What I have tried:
-Check the URL and template paths.
-Restart the Django server.
-Verify that the accueil.html file is indeed present in the templates/reservation/ folder.
**Questions:
Why is Django not able to find the accueil.html file? Is there an issue with my URL or view configuration?
Thank you for your help!