dimanche 23 mai 2021

Not able to get the requested URL in django new version

Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/customer/ Using the URLconf defined in crm.urls, Django tried these URL patterns, in this order:

admin/ The current path, customer/, 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.

Here is my code crm/urls.py--->

from django.contrib import admin
from django.urls import path,include


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('accounts.urls')),

]

now accounts/urls.py--->

from django.urls import path
from . import views


urlpatterns = [
    path('', views.home,name="ShopHome"),
    path('products/', views.products,name="ProductsHome"),
    path('customer/', views.customer,name="customerHome"),
]

Now accounts/view.py--->

from django.shortcuts import render
from django.http import HttpResponse



def home(request):
    return HttpResponse('home')

def products(request):
    return HttpResponse('products')

def customer(request):
    return HttpResponse('customer')

Please help me out guys I'm struck here for 2 days




Aucun commentaire:

Enregistrer un commentaire