The empty path didn’t match any of these

These are the urls and views:


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

urlpatterns = [
path(’’, include(‘frontend.urls’)),


from django.urls import path
from . import views

urlpatterns = [

path('products/', views.products, name='products'),

from django.shortcuts import render
from .models import *

def products(request):
products = Product.objects.all()
return render(request, ‘products.html’, {‘products’:products})

When I run python runserver, I get:
using the URLconf defined in ecom.urls, Django tried these URL patterns, in this order:

products/ [name=‘products’]
The empty path didn’t match any of these.

Kindly advise

Welcome to the Django forum!

Side note: When posting code here, enclose the code between lines of three backtick - ` characters. That means you will have a line of ```, then your code, then another line of ```. (When posting code from multiple files, it’s generally most useful to do this for each file individually.) This forces the forum software to keep your code properly formatted. This is also the recommended process when posting templates, error messages, and other pre-formatted text.

Also, when you get an error message, please copy/paste the full text of the error message and not an edited summary.

Now, having said all that, I’m guessing that you got this error when you tried to go to something like http://localhost/.

The error message is correct - you don’t have a path defined to respond to an empty path. What are you expecting to see at that url?

You are correct. That error comes following the use of
When I add the extension products"
nothing is displayed.

This is the full error message:

Page not found (404)

Request Method: GET
Request URL:

Using the URLconf defined in ecom.urls , Django tried these URL patterns, in this order:

  1. admin/
  2. products/ [name=‘products’]

The empty path didn’t match any of these.

Yes, because that’s not the same as:

(Notice the trailing slash in your url path definition.)

What’s your background with Django so far? What have you done in the way of training and learning to get yourself to this point?

This is part of my learning.
This was a tutorial from:

What should be the correct url?
Thanks for your advice.

Use the URL that the message is telling you to use.

I’m not familiar with that tutorial, so I can’t tell if you’ve missed a step, have done something wrong, or if there’s a problem with the tutorial. The only advice I can give in that regards is to double- and triple-check your work every step of the way.