June 19, 2010 will

Review of Django 1.2 E-commerce

I've worked with Django for more than two years now. The majority of the sites I have worked on have been social-networking or content based, but I have yet to do any serious work on a site where the main purpose is to advertise and sell products. So I when a copy of ‘Django 1.2 e-commerce’ landed on my desk I was intrigued by what it might cover that I hadn't been exposed to with other fields of Django development.

Django 1.2 e-commerce

Django 1.2 E-commerce

The book starts out with a brief run-down of Django. The first chapter is more of a explanation of the philosophy behind Django, and definitely not a tutorial. Which I think is fair enough; if you are building an e-commerce site, you are probably a professional Python developer and there are plenty of books to get you up to speed with Django. In the second chapter, the author runs through a simple web-shop application with an inventory and a ‘buy now’ button – which seemed more like a confidence building exercise than anything else, but it does do a good job of demonstrating how simple it can be to build this kind of application with Django.

The subsequent chapters go in to detail regarding managing users, shopping-carts and taking payments with Google Checkout and Amazon services. I've never used these payment services, so I found the information particularly interesting. I like the author's approach of making generic views in order to share functionality across payment services, but I would have liked some more detail in to the APIs involved.

Chapter 6 was a surprise, it covers a variety of modules that you can use to add powerful search capabilities to your application. Django's database querying will only get you so far with searching, if you need more sophisticated searching of the kind you would expect from Google then you will need to integrate one of a number of external modules and services, which chapter 6 covers pretty well. The following chapter covers exposing data via several APIs, and creating PDF reports with ReportLab, but not in any great detail.

I was impressed with chapter 8, which covers writing JavaScript to create rich AJAX interfaces – something which is pretty much expected in a modern web-site. I would have preferred a more detail here, but only because I have a particular interest in front-end technologies. The next chapter explains how to integrate a Django application with Amazon payment services and S3 storage to sell digital goods, and goes it to more detail than other chapters.

The final chapter covers a number of options you will have for deploying your application. If your application is moderately sophisticated and has many components, deployment can be a tricky affair. This chapter explains how Python technologies such as Fabric, Buildout and Virtualenv can ease deployment headaches. It also covers serving the site with Apache and ‘mod_wsgi’.

The code snippets in this book are pretty good at demonstrating the subjects covered, but I did notice some quite glaring syntax errors in several of the code examples. The errors weren't subtle either; they would result in the code not even running. I suspect that many of them were likely to be the result of a non-technical editor re-formating the code and not a mistake on the part of the author, but there were also a number of programming errors and bad practices which were a little disapointing to see in a book aimed at professionals. For instance, the author consistently used the ‘is’ operator in place of the equality operator (they are not interchangable even though they may appear to be).

Overall, my impression of this book was favourable. It's definitely not a tutorial book in that its not going to teach you any new skills – since it covers so many technologies and doesn't go in to great detail about any of them. What it will do is give you a grounding of the components in an e-commerce system. If you are looking to build some kind of web-shop in Django then I would recommend this book. It's less of an essential purchase if you aren't working with e-commerce, but since many of the topics discussed in Django 1.2 e-commerce are applicable to other web-sites you may still want to check this book out.

Use Markdown for formatting
*Italic* **Bold** `inline code`

Links to [Google](http://www.google.com)

> This is a quote

import this
your comment will be previewed here
Issac kelly 5 years ago
Was there any discussion of existing django store apps? Satchmo?
Will McGugan 5 years ago
Issac, I'm afraid not. The book assumes you will be starting from scratch.
Ralph Corderoy 5 years ago
Could we have a line from the book where use of `is' is wrong?
Will McGugan 5 years ago
Ralph, I would say the following from page 84 is wrong, for some value of wrong.

if request.method is not 'POST':
    raise Http404

I imagine this works fine, but it is dependant on how Django assigns a value to request.method and the implementation of Python.
Mike Howarth 5 years ago
I'm a bit suprised there isn't any reference to Satchmo. I thought it was ‘the’ Django e-commerce framework.

My past experiences of it have been reasonably positive.
Tim 5 years ago
Hi, You did not mention the other side of the book…

I think it is probably written in a short time frame, so the code is not complete. You even don't have a store running at the end of the book. He explained something about product, catalog, order and payment processing. But the logic is not that clear, there should be a mainline and a consistent style across the book.

Just my opinion…
Ed Marshall 5 years ago
Is there any mention of PCI compliance or the dangers of handling credit card data in the US these days?
Tim 5 years ago
Ed, I don't think he mentioned anything about these. But I could be wrong since I can't bear to read the whole book. not well written at all.
Steve 5 years ago
I'm writing a django ecommerce SAAS application for shopping /auctions and this just provides an overview.

Satchmo is good, but we started from scratch. Flexibility was an issue.

Don't be fooled PCI compliance is a huge part of our work.

Three chapters on pci alone would be needed

We need to discuss the whole lifecycle to get a site live in these types of books, code is only 50% of the work