i am getting not right path after adding ap_name in my app/urls.py what is going wrong i dont know i


from django.urls import path

from . import views

        app_name = 'blog'

         urlpatterns = [

             path('', views.home_page, name = "home"),
             path('about/', views.about_page, name = "about"),
             path('contact/', views.contact_page, name = "contact"),
             path('products/<int:page_id>/', views.product_details, name = "products"),
             path('add-product/', views.create_product_page, name = "create_product"),
             path('update-product/', views.update_product_page, name = "update_product"),
             path('delate-product/', views.contact_page, name = "delete_product"),


2 Answers

akm sharma On

You are calling it in wrong way to go to Blog app url you have to call it in this way

<a class="navbar-brand" href="{% url 'blog:home' %}">Home</a>
Dimitris Kougioumtzis On

You don't pass the namespace if you want to call the home url you have to include the namespace

<a class="navbar-brand" href="{% url 'blog:home' %}">Home</a>