Last modified 2021-02-11.
Time to read: 5 minutes.
djangocollection, categorized under Django, Django-Oscar, Open Source, PostgreSQL, Python, e-commerce.
In previous posts I described my e-commerce requirements and Python e-commerce frameworks. In a nutshell, I need a custom or semi-custom shopping cart with good coupon/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.
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 was 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 no such project has emerged yet, and it will take a while for such a project to mature. 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.
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 gets tickled every 5 months or so; it is a hobby project. 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, and that 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.
I could imagine a more robust starting point. I'll keep looking for another package.
Next up is django-SHOP. Here is the Pypi page. From the docs:
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.
It is multilingual, multicurrency, uses REST, and instead of documented coupon support there is a placeholder chapter entitled “Handling Discounts”.
Google brought me the
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.
Unclear to me if it is a plugin, a coroutine, or a replacement for django-SHOP.
django-shop-discounts has been alpha software for 9 years,
and has not been touched in 7 years.
I probably do not want to try to work with something that stale.
Perhaps I might learn something from looking at it, however.
According to the
cookiecutter-django-shop GitHub project,
one does not simply install
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
I see documentation for using Postgres.
There is also a Troubleshooting document;
that makes me happy.
I wonder how malleable this software is.
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.
>55K downloads / 90 days.
I almost dismissed
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.
From the documentation:
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.
For me, the most important sentence on that page was that
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.
To that end I started writing a separate series of posts