2. Quickstart a Running Demo

2.1. Using a Docker image

To get a first impression of the djangoSHOP examples, you may use a prepared Docker container. If not already available on your workstation, first install the Docker runtime environment and start a Docker machine.

Now you may run a fully configured djangoSHOP image on your local machine:

docker run -p 9001:9001 jrief/uwsgi-django-shop:latest

This image is rather large (1.7 GB) therefore it may take some time to download.

Locate the IP address of the running container using docker-machine ip default. Then point a browser onto this address using port 9001, for instance http://192.168.99.100:9001/en/

Please note that before bootstrapping, a full text index is built and the images are thumbnailed. This takes additional time. Therefore, if you stop the running container, before rerunning the Docker image it is recommended to restart the container. First locate it using

$ docker ps -a
CONTAINER ID  IMAGE                           COMMAND                 CREATED
79b7b69a7473  jrief/uwsgi-django-shop:latest  "/usr/sbin/uwsgi --in"  11 minutes ago
...
$ docker start 79b7b69a7473

and then restart it. The access the administration backed, sign in as user “admin” with password “secret”.

Note

This demo does not function with the Payment Service Provider Stripe, because each merchant requires its own credentials. The same applies for sending emails, because the application requires an outgoing SMTP server.

2.2. The classic approach

Alternatively you may also download all dependencies and start the project manually. If you want to use the demo as a starting point, this probably is the better solution.

Filling your CMS with page content and adding products is a boring job. Impatient users may start three demos using some prepared sample data. First assure that all dependencies are installed into its virtual environment as described in section “Prepare the Installation”. Then instead of adding pages and products manually, download the media files and unpack them into the folder django-shop:

(shoptutorial)$ tar zxf DOWNLOAD/FOLDER/django-shop-workdir.tar.gz

Starting from this folder, you can run all three demos: The first, simple demo shows how to setup a monolingual shop, with one product type. The second, internationalized demo shows how to setup a multilingual shop, with one product type. For translation of model attributes, this installation uses the django-parler app. The third, polymorphic demo shows how to setup a shop with many different product types. To handle the polymorphism of products, this installation uses the django-polymorphic app.

Note

All demos can be started independently from each other, but you are encouraged to start with the “Simple Product”, and then proceed to the more complicate examples.

2.3. Simple Product Demo

Assure you are in the django-shop folder and using the correct virtual environment. Then in a shell invoke:

(shoptutorial)$ cd example
(shoptutorial)$ export DJANGO_SHOP_TUTORIAL=simple DJANGO_DEBUG=1
(shoptutorial)$ ./manage.py migrate
(shoptutorial)$ ./manage.py loaddata fixtures/myshop-simple.json
(shoptutorial)$ ./manage.py runserver

Point a browser onto http://localhost:8000/admin/ and sign in as user “admin” with password “secret”.

This runs the demo for Modeling a simple product.

2.4. Internationalized Products

In this demo the description of the products can be translated into different natural languages.

When migrating from the Simple Products demo, assure you are in the django-shop folder and using the correct virtual environment. Then in a shell invoke:

(shoptutorial)$ cp workdir/db-simple.sqlite3 workdir/db-i18n.sqlite3
(shoptutorial)$ cd example
(shoptutorial)$ export DJANGO_SHOP_TUTORIAL=i18n DJANGO_DEBUG=1
(shoptutorial)$ ./manage.py migrate
(shoptutorial)$ ./manage.py runserver

Alternatively, if you prefer to start with an empty database, assure that the file workdir/db-i18n.sqlite3 is missing. Then in a shell invoke:

(shoptutorial)$ cd example
(shoptutorial)$ export DJANGO_SHOP_TUTORIAL=i18n DJANGO_DEBUG=1
(shoptutorial)$ ./manage.py migrate
(shoptutorial)$ ./manage.py loaddata fixtures/myshop-i18n.json
(shoptutorial)$ ./manage.py runserver

Point a browser onto http://localhost:8000/admin/ and sign in as user “admin” with password “secret”.

This runs a demo for Modeling a Multilingual Product.

2.5. Polymorphic Products

In this demo we show how to handle products with different properties and in different natural languages. This example can’t be migrated from the previous demos, without loosing lots of information. It is likely that you don’t want to add the Smart Phones manually, it is suggested to start using a fixture.

This example shows how to add Smart Phones in addition to the existing Smart Cards. Assure you are in the django-shop folder and using the correct virtual environment. Then in a shell invoke:

(shoptutorial)$ rm workdir/db-polymorphic.sqlite3
(shoptutorial)$ cd example
(shoptutorial)$ export DJANGO_SHOP_TUTORIAL=polymorphic
(shoptutorial)$ ./manage.py migrate
(shoptutorial)$ ./manage.py loaddata fixtures/myshop-polymorphic.json
(shoptutorial)$ ./manage.py runserver

Point a browser onto http://localhost:8000/admin/ and sign in as user “admin” with password “secret”.

This runs a demo for Products with Different Properties.