Skip to main content

An extension for Oscar to include stores

Project description

============
Oscar stores
============

.. image:: https://secure.travis-ci.org/django-oscar/django-oscar-stores.png
:target: http://travis-ci.org/#!/django-oscar/django-oscar-stores

.. image:: http://codecov.io/github/django-oscar/django-oscar-stores/coverage.svg?branch=master
:alt: Coverage
:target: http://codecov.io/github/django-oscar/django-oscar-stores?branch=master

This is an extension for django-oscar_ that adds support for stores. It
provides:

.. _django-oscar: https://github.com/django-oscar/django-oscar

* A store locator page using Google maps for geocoding. It also supports using
the browser's location to show the nearest stores.
* Store detail pages including opening hours
* Store groups
* A dashboard for managing stores

It's highly extensible and can be used as a foundation for building sophisticated
stores functionality within Oscar sites.

Screenshots
-----------

Customer-facing pages:

.. image:: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/locator.thumb.png
:target: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/locator.png

.. image:: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/detail.thumb.png
:target: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/detail.png

Dashboard pages:

.. image:: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/dashboard-list.thumb.png
:target: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/dashboard-list.png

.. image:: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/dashboard-detail.thumb.png
:target: https://github.com/django-oscar/django-oscar-stores/raw/master/docs/images/dashboard-detail.png

Dependencies
------------

GeoDjango_ is used so a spatial database is required. We recommend PostGIS.
Django's docs include some `installation instructions`_ although it is renowned
for being tricky.

.. _GeoDjango: https://docs.djangoproject.com/en/stable/ref/contrib/gis
.. _`installation instructions`: https://docs.djangoproject.com/en/stable/ref/contrib/gis/install

Spatialite is another option although it can be tricky to set up. On Ubuntu,
you can do the following:

.. code:: bash

$ sudo apt-get install spatialite-bin libspatialite3 libgeos++-dev libgdal-dev libproj0

The ``pysqlite`` python package is also required although it doesn't support C
extensions by default. To work-around this, there are two options:

1. Download the package, edit ``setup.cfg`` to enable C extensions and install:

.. code:: bash

$ pip install pysqlite --no-install
$ vim $VIRTUAL_ENV/build/pysqlite/setup.cfg
$ pip install pysqlite

2. Use a custom branch:

.. code:: bash

$ pip install git+git://github.com/tinio/pysqlite.git@extension-enabled#egg=pysqlite

.. _`pysqlite`: http://code.google.com/p/pysqlite

Installation
------------

First, ensure you are using a spatial database and have django-oscar installed.

Install package:

.. code:: bash
$ pip install django-oscar-stores

then add ``stores`` to ``INSTALLED_APPS``. Now update your root ``urls.py``:

.. code:: python

from django.views.i18n import JavaScriptCatalog
from oscar.app import shop
from stores.app import application as stores_app
from stores.dashboard.app import application as dashboard_app

urls = [
# basic configuration for Oscar
url(r'', shop.urls),

# adds URLs for the dashboard store manager
url(r'^dashboard/stores/', dashboard_app.urls),

# adds URLs for overview and detail pages
url(r'^stores/', stores_app.urls),

# adds internationalization URLs
(r'^jsi18n/$', JavaScriptCatalog.as_view(), name="javascript-catalogue"),
]

You also need to download the `GeoIP data files`_ and set ``GEOIP_PATH`` to point to the
appropriate directory.

.. _`GeoIP data files`: https://docs.djangoproject.com/en/stable/ref/contrib/gis/geoip/

Settings
--------

* ``GOOGLE_MAPS_API_KEY`` (default: not set). Maps API key for use with Maps and Geocode APIs.
You must provide this key.

* ``STORES_GEOGRAPHIC_SRID`` (default: ``3577``). This is used for distance
calculations. See http://spatialreference.org for more details.

* ``STORES_GEODETIC_SRID`` (default: ``4326``).

* ``STORES_MAX_SEARCH_DISTANCE`` (default: None). This filters stores
in queries by distance. Units can be set using distance object:

.. code:: python

from django.contrib.gis.measure import D
# Maximal distance of 150 miles
STORES_MAX_SEARCH_DISTANCE = D(mi=150)
# Maximal distance of 150 kilometers
STORES_MAX_SEARCH_DISTANCE = D(km=150)

Contributing
------------

There is sandbox site within the repo which is a sample Oscar project that uses
the stores extension. Set this up with:

.. code:: bash

$ make sandbox

then fetch the GeoIP files with:

.. code:: bash

$ make geoip

This loads a fixture which provides a superuser to test the dashboard with::

email: superuser@example.com
username: superuser
password: testing

Run tests with:

.. code:: bash

$ pytest

License
-------

``django-oscar-stores`` is released under the permissive `New BSD license`_.

.. _`New BSD license`: http://github.com/django-oscar/django-oscar-stores/blob/master/LICENSE


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-oscar-stores-1.1.1.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

django_oscar_stores-1.1.1-py2.py3-none-any.whl (39.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-oscar-stores-1.1.1.tar.gz.

File metadata

  • Download URL: django-oscar-stores-1.1.1.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for django-oscar-stores-1.1.1.tar.gz
Algorithm Hash digest
SHA256 1d12d36c8517a6703f8bedee3aca1dc5b384e8c008c446ede593a539bb03abce
MD5 0c04be561fcd826cdf1958dd01c57f46
BLAKE2b-256 b3a5ccd145598ed9e930e08af6f8e9aac80f9d094967792ac23bae2b81c5523f

See more details on using hashes here.

File details

Details for the file django_oscar_stores-1.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: django_oscar_stores-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for django_oscar_stores-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bc632154c44411bb2ec04bee42e90b4701b1753fea1f6533a7da1f1709bd4fb2
MD5 124ad58da0ab35ab6b4a5889dcb22c3f
BLAKE2b-256 31dde7387dcd1a7c65c646442de390d927f5f1be1db7aff2062a141ab47911f4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page