Django and Oscar

Shopping Carts Powered by Python and Django

Published 2021-02-03. Last modified 2021-02-11.
Time to read: 5 minutes.

This page is part of the django collection.

I described my e-commerce requirements in a previous article. In a nutshell, I need a custom or semi-custom shopping cart with good coupon and discount support and an external pricing module. The shopping cart will be used in a proof-of-concept project to determine the commercial viability of a business idea.

Django: The web framework for perfectionists with deadlines

Build vs. Acquire

I considered writing a shopping cart myself in Django or Flask. It seemed like Django would be less work, while Flask would allow a more carefully crafted result after quite a lot more work, with a higher risk of problems.

If I were to develop something new, I felt that a starter project would be helpful. I would prefer to start with some working code that I could modify and build on. A high-quality open-source project that meets my needs would also be wonderful, but I did not have high hopes. However, customizing a proven product would be much less work and entail less risk than building something new.

Django and Flask Popularity

The February 2020 survey by Statistica of the most used web frameworks among developers worldwide shows Django and Flask tied for tenth place. Ruby on Rails is also shown in 13th place, with half the popularity. Some of the technologies shown in the infographic are not actually web frameworks because they have no server-side component (jQuery, react.js, Angular, Vue.js). The most popular server-side web application framework is Microsoft ASP.NET, followed by Express, Spring and Django / Flask.

Avoid Bleeding-Edge Technology

The possibility of implementing a Serverless Flask shopping cart was most intriguing, but when this article was originally published, no such project had emerged yet. Since then, Stetson Blake wrote a nice tutorial entitled Building a Serverless Ecommerce Store. This was not a full-fledged store, however, since it had no coupon support.

Similarly, Serverless using Spot Images is also intriguing.

Both of these possibilities represent bleeding-edge technology. In a few years, these revolutionary technologies may be incorporated into the way e-commerce is done.

There is no sense in undertaking a significant technical challenge to evaluate a proof of concept for a business idea unless the potential business opportunity is somehow intrinsic to the nature of the technology.

In other words, playing with shiny toys does not enhance business value.


django-shopping-cart is available on PyPi. The product description is written in broken English, which is never a good sign: “Django Shopping Cart is a Django app to store product in cart.”

The GitHub project page showed me that this project used to get tickled every 5 months or so; this is a hobby project. The version number, 0.1.0, was never updated. That's ok with me, if it gets the job done. I only need a shopping cart for a business POC.

The project uses a BSD License, so no problem there. It works with Python 3.8, which is reasonably recent. Only a partial SQL schema is shown for the most rudimentary shopping cart. This project is the merest outline of a sketch of a shopping cart, and there was no coupon support or payment processing support.

This project is effectively dead. The GitHub project has not been updated since February, 2015.

I could imagine a more robust starting point. I’ll keep looking for another package.


Next up is django-SHOP.

Django-SHOP is an e-commerce framework rather than a turn-key solution. This means that the merchant is in charge of the project and that django-SHOP acts as one of the third party dependencies making up the whole project. We name this the merchant implementation.  – From Django-SHOP Tutorial

It is multilingual, multicurrency, and uses REST. However, instead of documenting coupon support, there is a placeholder chapter entitled “Handling Discounts”, which has not been updated for several years.

This project is effectivly dead. The GitHub project has not been updated since February, 2021. I’ll keep looking for another package.


Google brought me the django-shop-discounts GitHub project, which has documentation on the feature that I want but calls the feature by another name. django-shop-discounts is currently an alpha version; that's ok, maybe. It is also in a different code base. It is unclear to me if it is a plugin, a coroutine, or a replacement for django-SHOP.

Django-shop-discounts was alpha software for 9 years before it was archived by the owner on Jun 14, 2023. This project is definitely dead.


According to the cookiecutter-django-shop GitHub project, one does not simply install django-SHOP. Instead, cookiecutter-django uses a cookie-cutter (template) approach to crafting a Django-SHOP installation. The cookiecutter project supports PayPal and Stripe, which is good, but I would prefer to have my own merchant account. It also supports SendCloud, which is also good, but I will only be selling to the US and Canada. I wish there was something similar to SendCloud for North America. I still have no idea if django-SHOP supports discounts/coupons or not.

cookiecutter-django-shop pull requests get addressed; that is good. The project has a few unit tests using pytest. I see documentation for using Postgres. There is also a Troubleshooting document; that makes me happy.

I wonder how malleable this software is. I will keep looking.

Django by Example: Creating a Coupon System

Packt Publishing published a video on YouTube entitled “Django by Example: Creating a Coupon System”, which is an excerpt from a book of the same name. I know Packt Publishing as a low-budget technical publishing house specializing in software development topics.

I skipped through the video and found it had rather low production value. Media professionals use the term production value to refer to technical aspects of program quality.

I have low expectations for Packt Publishing, and a book about one aspect of a store does not fullfil my needs.


In top 3% at PyPI.
>55K downloads / 90 days.

I almost dismissed django-oscar when I found it. The first impression it gave me was of complex enterprise software. The second impression was that django-oscar seemed to be exactly what I needed. Yes, it is complex, but that is because it is very malleable.

Oscar is “domain-driven” in the sense that the core business objects can be customized to suit the domain at hand. In this way, your application can accurately capture the subtleties of its domain, making feature development and maintenance much easier.

  • A range of merchandising blocks for promoting products throughout your site.
  • Sophisticated offers that support virtually any kind of offer you can think of - multi-buys, bundles, buy X get 50% off Y etc.
  • Vouchers (built on top of the offers framework).
  • Comprehensive dashboard that replaces the Django admin completely.
  • Support for complex order processing such split payment orders, multi-batch shipping, order status pipelines.
  • Extension libraries available for many payment gateways, including PayPal, GoCardless, DataCash and more.

Oscar is a good choice if your domain has non-trivial business logic.

 – From the django-oscar documentation

For me, the most important sentence on that page was that django-oscar supported Dynamically priced products (e.g. where the price is provided by an external service).

I decided I had to check out django-oscar in depth. I eventually wrote the series of articles on django and django-oscar that you are reading now.

* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.