Home > Net >  Django tried these URL patterns, in this order
Django tried these URL patterns, in this order

Time:03-15

When I click on a link it always comes out not found error while on the home page it goes well. Here are my url patterns:

from django.contrib import admin
from django.urls import path
from App import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.index, name='index'),
    path('qui_sommes_nous/', views.qui_sommes_nous, name='qui_sommes_nous'),
    path('equipe/', views.equipe, name='equipe'),
    path('galerie/', views.galerie, name='galerie'),
    path('avendre/', views.avendre, name='avendre'),
    path('alouer/', views.alouer, name='alouer'),
    path('realisation/', views.realisation, name='realisation'),
    path('contact/', views.contact, name='contact'),
    path('details_des_appartement/', views.details_des_appartement, name='details_des_appartement'),

   
]

please help me solve this problem.

CodePudding user response:

Your paths need to have a slash as prefix, so:

<a href="/contact/">contact</a>

for example. Not:

<a href="contact/">contact</a>

Better is to make use of the {% url … %} template tag [Django-doc]:

<a href="{% url 'contact' %}">contact</a>
  • Related