Django Oscar

Posted : admin On 1/26/2022
  1. Django Oscar Github
  2. Django Oscars Won
  3. Has Tarantino Won An Oscar
  4. Django Oscar Theme
  5. Django Oscar Nominations
  6. Github Oscar
  7. Django Oscar Wins

For simplicity, let’s assume you’re building a new e-commerce project fromscratch and have decided to use Oscar. Let’s call this project frobshop


You can always review the set-up of theSandbox site in case you have trouble withthe below instructions.

  1. Oscar ¶ Domain-driven e-commerce for Django ¶ Oscar is an e-commerce framework for building domain-driven applications. It has flexibility baked into its core so that complicated requirements can be elegantly captured.
  2. Hi i am creating a project in django and installing all oscar dependencies. Pip install django-oscar using this command and configure the project as per documentation.

Managed accounts for Django A 'managed account' is an allocation of money that can be debited and credited. This package provides managed account functionality for use with the e-commerce framework Oscar. Accounts can be used to implement a variety of interesting components, including.

Install Oscar and its dependencies¶

Install Oscar (which will install Django as a dependency), then create theproject:

If you do not have mkvirtualenv, then replace that line with:

This will create a folder frobshop for your project. It is highlyrecommended to install Oscar in a virtualenv.


sorl-thumbnail is an optional dependency for image thumbnail, but is what Oscar expectsto use by default. It can be replaced with easy-thumbnails or a custom thumbnail backend. If you want touse a different backend then remember to change the OSCAR_THUMBNAILER setting to point to it.


Please ensure that pillow, a fork of the the Python Imaging Library(PIL), gets installed with JPEG support. Supported formats are printedwhen pillow is first installed.Instructions on how to get JPEG support are highly platform specific,but guides for PIL should work for pillow as well. Generallyspeaking, you need to ensure that libjpeg-dev is installed and foundduring installation.

Django settings¶

First, edit your settings file frobshop/frobshop/ to import all of Oscar’s default settings.

Now add Oscar’s context processors to the template settings, listed below:

Next, modify INSTALLED_APPS to be a list, and add django.contrib.sites,django.contrib.flatpages, Oscar’s core apps, and third-party apps that Oscardepends on. Also set SITE_ID:

Note that Oscar requires django.contrib.flatpages which isn’tincluded by default. flatpages also requires django.contrib.sites.More info about installing flatpages is in the Django docs.


Oscar’s default templates use django-widget-tweaks but it’soptional really. You may decide to use your own templates thatdon’t use either.

Next, add oscar.apps.basket.middleware.BasketMiddleware anddjango.contrib.flatpages.middleware.FlatpageFallbackMiddleware toyour MIDDLEWARE setting.

Set your authentication backends to:

to allow customers to sign in using an email address rather than a username.

Ensure that your media and static files are configured correctly. This meansat the least setting MEDIA_URL and STATIC_URL. If you’re serving fileslocally, you’ll also need to set MEDIA_ROOT and STATIC_ROOT.Check out the sandbox settings for a working example. If you’re servingfiles from a remote storage (e.g. Amazon S3), you must manually copy a“Image not found” image into MEDIA_ROOT.

Search backend¶

If you’re happy with basic search for now, you can just add Haystack’s simplebackend to the HAYSTACK_CONNECTIONS option in your Django settings:

Oscar uses Haystack to abstract away from different search backends.Unfortunately, writing backend-agnostic code is nonetheless hard andApache Solr is currently the only supported production-grade backend. YourHaystack config could look something like this:

Django Oscar Github

Oscar includes a sample schema to get started with Solr. More information canbe found in therecipe on getting Solr up and running.


Check your database settings. A quick way to get started is to use SQLite:

Note that we recommend using ATOMIC_REQUESTS to tie transactions torequests.


Alter your frobshop/ to include Oscar’s URLs. You can also includethe Django admin for debugging purposes. But please note that Oscar makes noattempts at having that be a workable interface; admin integration existsto ease the life of developers.

If you have more than one language set your Django settings for LANGUAGES,you will also need to include Django’s i18n URLs:

Create database¶

Oscar ships with migrations. Django’s migration framework will detect themautomatically and will do the right thing.Create the database and the shop should be browsable:

You should now have an empty, but running Oscar install that you can browse athttp://localhost:8000.

Initial data¶

Did django win any awards

The default checkout process requires a shipping address with a country. Oscaruses a model for countries with flags that indicate which are valid shippingcountries and so the country database table must be populated beforea customer can check out.

The easiest way to achieve this is to use country data from the pycountrypackage. Oscar ships with a management command to parse that data:

By default, this command will mark all countries as a shipping country. Callit with the --no-shipping option to prevent that. You then need tomanually mark at least one country as a shipping country.

Django Oscars Won

Creating product classes and fulfilment partners¶

Every Oscar deployment needs at least oneproductclassand onefulfilmentpartner.These aren’t created automatically as they’re highly specific to the shop youwant to build.

When managing your catalogue you should always use the Oscar dashboard, whichprovides the necessary functionality. Use your Django superuser email and password to login to: and create instances of both there.


It is important to note that the Django admin site is not supported. It mayor may not work and is only included in the sandbox for developer’sconvenience.

For a deployment setup, we recommend creating product classesas data migration.

Defining the order pipeline¶

The order management in Oscar relies on the order pipeline thatdefines all the statuses an order can have and the possible transitionsfor any given status. Statuses in Oscar are not just used for an orderbut are handled on the line level as well to be able to handle partialshipping of an order.

The order status pipeline is different for every shop which means thatchanging it is fairly straightforward in Oscar. The pipeline is defined inyour file using the OSCAR_ORDER_STATUS_PIPELINE setting.You also need to specify the initial status for an order and a line item inOSCAR_INITIAL_ORDER_STATUS and OSCAR_INITIAL_LINE_STATUSrespectively.

To give you an idea of what an order pipeline might look like take a lookat the Oscar sandbox settings:

Has Tarantino Won An Oscar

Defining the order status pipeline is simply a dictionary of where eachstatus is given as a key. Possible transitions into other statuses can bespecified as an iterable of status names. An empty iterable defines anend point in the pipeline.

With these three settings defined in your project you’ll be able to seethe different statuses in the order management dashboard.

Next steps¶

The next step is to implement the business logic of your domain on top ofOscar. The fun part.

Domain-driven e-commerce for Django¶

Oscar is an e-commerce framework for building domain-driven applications. Ithas flexibility baked into its core so that complicated requirements can beelegantly captured. You can tame a spaghetti domain without writing spaghetticode.

Years of e-commerce hard-earned experience informs Oscar’s design.

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



  • Any product type can be handled including downloadable products,subscriptions, child products (e.g., a T-shirt in different sizes and colours).

  • Customisable products, such as T-shirts with personalised messages.

  • Large catalogue support - Oscar is used in production by sites withmore than 20 million products.

  • Multiple fulfilment partners for the same product.

  • A range of merchandising blocks for promoting products throughout your site.

  • Sophisticated offers that support virtually any kind of offer you can thinkof - 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-batchshipping, 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. Oscar’sflexibility means it’s straightforward to implement business rules that would bedifficult to apply in other frameworks.

Django Oscar Theme

Example requirements that Oscar projects already handle:

Django Oscar Nominations

  • Paying for an order with multiple payment sources (e.g., using a bankcard,voucher, gift card and points account).

  • Complex access control rules governing who can view and order what.

  • Supporting a hierarchy of customers, sales reps and sales directors - eachbeing able to “masquerade” as their subordinates.

  • Multi-lingual products and categories.

  • Digital products.

  • Dynamically priced products (e.g. where the price is provided by an externalservice).

Github Oscar

Django Oscar

Oscar is used in production in several applications to sell everything from beermats to hotel beds. The source is on GitHub - contributions are always welcome.

Django Oscar Wins

First steps¶

Using Oscar¶

All you need to start developing an Oscar project.


The Oscar open-source project¶

Learn about the ideas behind Oscar and how you can contribute.