DEV Community

Charles Ouellet
Charles Ouellet

Posted on • Originally published at snipcart.com on

Guide to Django E-Commerce (Bonus: a Wagtail Shop Tutorial)

Guide to Django E-Commerce (Bonus: a Wagtail Shop Tutorial)

"D-J-A-N-G-O. The D is silent."

Man, I love that line. So badass.

But the eponymous character from Quentin Tarantino's masterpiece isn't the only badass Django in town.

So is the popular Python framework of the same name.

Today, I'm leaving the realm of JavaScript frameworks for a quick venture into Django e-commerce.

django

In this post, I'll answer legitimate questions you might have when starting a new e-commerce project, such as:

Is Python the right language for my project? And Django the right framework? Which tools or plugins should I use?

Then, I'll show you our homemade recipe for Django-powered e-commerce success with a step-by-step Wagtail CMS tutorial:

  • Creating a new Wagtail site.
  • Adding Snipcart configuration settings.
  • Generating database migrations.
  • Creating new products for your Django store.
  • Crafting an e-commerce template.

Let's start with the basics.

The State of Python

One of the main reasons to pick Django as a framework is its Python foundation.

A general purpose, dynamic programming language, Python was developed by ex-Googler Guido van Rossum in the late 80's. A fan of Monthy Python, he took one-half of the name to baptize his programming project.

monty-python

How can you not be fan?

He wasn't joking though. To say that Python has become "popular" is an understatement.

Today, it's used by hundreds of thousands of developers all over the world. As StackOverflow puts it:

The term “fastest-growing” can be hard to define precisely, but we make the case that Python has a solid claim to being the fastest-growing major programming language.

A few reasons explain the Python love:

  • Its grammatical readability is awesome.
  • It has a fast learning curve for newcomers.
  • It boasts a long-lasting, solid ecosystem of libraries & community
  • It's now the standard language for data science & machine learning.
  • It powers great dev tools like Pelican, a neat static blog generator.
  • Reddit is written in Python. ;)

What about the Django framework?

Django is an open source, high-level Python web framework. Its emphasis on reusable components makes it faster for developers to build web apps on top of Python. It presents itself as a web framework for perfectionists with deadlines.

django-framework

Now maintained by the Django Software Foundation, it was originally written by two brilliant Lawrence Journal-World developers. Oh, and while Python draws its name from comedy icons, Django got his from a versatile guitar legend: Django Reinhardt!

As a full-stack framework, it overshadows pretty much any alternative tool out there. It's fast, fully loaded, secure, scalable & versatile. All characteristics you'll probably want to apply to your e-commerce setup!

Why use Django for e-commerce?

While you can do a lot with Django, let's keep the focus on what it brings to e-commerce and the different tools available to put together an online store.

First, here are some Django features to consider if you're looking for the right framework to build a shop.

Scalability

Django is perfect for e-commerce startups, as it's a good fit for small websites, but also has scales perfectly with business growth. You can rely on Django to handle hundreds/thousands of visitors at a time. Its built with independent components you can unplug or replace depending on your needs at any specific time.

Security

With e-commerce, you want to make sure merchants and clients alike feel safe through your shopping experience. Django prevents a whole lot of common security mistakes which often are what weakens traditional PHP CMSs. For instance, Django hides your site's source code from direct viewing on the web by dynamically generating web pages.

Feature-rich

Compared to most frameworks, Django comes with way more features out-of-the-box. It allows you to build an app right off the bat. Perfect for supporting your online store with functionalities such as user authentification, content management or RSS feed. If something seems to be missing, you can count on Django's community and plugins ecosystem to extend your app!

SEO-friendly

SEO is paramount for any online business. While other frameworks don't natively play well with search engines (mainly JavaScript frameworks, like Vue or React, at least Django advocates best practices for SEO. Human-readable URLs and sitemap features are sure to please any marketing team.

Oh and also, it's fast. Which is always great for both customer experience and SEO.

Reliable

It has been crowd-tested for a while now, and the community surrounding it is widely supportive. It's continuously updated by active developers; maybe you'll even find yourself contributing. ;)

Read the rest of this post and find the technical tutorial [here].(https://snipcart.com/blog/django-ecommerce-tutorial-wagtail-cms)

Top comments (1)

Collapse
 
sandrine911 profile image
Sandrine911

thank you for publishing I always try to be up to date when it comes to e-commerce tips. When it comes to free sources of knowledge, it's worth checking out these 5 ebooks for free pay.g2a.com/blog/grow-your-ecommer...