VOOZH about

URL: https://www.geeksforgeeks.org/python/e-commerce-product-catalog-using-django/

⇱ E-commerce Product Catalog using Django - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

E-commerce Product Catalog using Django

Last Updated : 23 Jul, 2025

We will build a simple e-commerce product catalog using Django. You'll learn how to create a product model, display product listings and details with dynamic templates, handle images, and configure URLs and media files all step-by-step to help you create a solid foundation for an online store.

Create Your Django Project and App

Prerequisites:

Open a terminal and run:

django-admin startproject ecommerce
cd ecommerce
python manage.py startapp catalog

Register the App

Open ecommerce/settings.py, find the INSTALLED_APPS list, and add 'catalog':

INSTALLED_APPS = [
# other installed apps
'catalog',
]

Note: An e-commerce product catalog is a great Django project to work on. To master building complex web applications like this, the Django Web Development Course can guide you step-by-step.

Define Your Product Model

In catalog/models.py, define the Product model:

Register the Model with Admin

To manage products easily through Django's admin panel, register your model in catalog/admin.py:

Create Views for Listing and Detailing Products

In catalog/views.py, add views:

Define URL Patterns

Create catalog/urls.py and set URLs:

In your main project ecommerce/urls.py, include these:

Create HTML Templates

Inside the catalog app folder, create a templates/catalog directory and add the following HTML files.

index.html (Product List)

index2.html (Product Detail)

This HTML file is used to view the particular product on the page.

Set Up Static and Media Files

Configure ecommerce/settings.py to serve static and media files during development:

Apply Migrations and Run the Server

Apply migrations to create the Product table:

python manage.py makemigrations
python manage.py migrate

Create a superuser to access the admin:

python manage.py createsuperuser

Run the development server:

python manage.py runserver

Output

👁 p1
When we click on particular Product:

👁 Screenshot-from-2023-10-01-12-56-05

Comment