Blog‎ > ‎

Trying Out Shoop eCommerce

posted Jul 11, 2015, 12:39 PM by Pasi Orovuo   [ updated Jul 11, 2015, 12:40 PM ]
Shoop is a new eCommerce platform developed and open sourced by Anders Innovation (https://www.andersinnovations.com/en/). It caught my attention because the company behind it has been some fairly interesting projects and is packed with promising talent. Additionally, it's based on Python and Django - the platforms I've been developing mainly on lately.

Shoop is its early stages and beginning of its lifecycle, so it seems to be a bit rough around the edges and the documentation published is not exactly comprehensive. I gave it a test run and here are the notes written during process.

Downloading and Installing


There does not seem to be official releases (or maybe it's their development model) and Shoop is only available via Github (https://github.com/shoopio/shoop). First though, create a virtualenv to accommodate the project and activate it:

pormb:Sites por$ virtualenv shooptest
New python executable in shooptest/bin/python
Installing setuptools, pip...done.
pormb:Sites por$ cd shooptest/
pormb:shooptest por$ source bin/activate
(shooptest)pormb:shooptest por$
Then clone the repository, and install Shoop and its dependencies.
(shooptest)pormb:shooptest por$ git clone https://github.com/shoopio/shoop.git
Cloning into 'shoop'...
remote: Counting objects: 1752, done.
remote: Total 1752 (delta 0), reused 0 (delta 0), pack-reused 1752
Receiving objects: 100% (1752/1752), 2.43 MiB | 1.53 MiB/s, done.
Resolving deltas: 100% (705/705), done.
Checking connectivity... done.
(shooptest)pormb:shooptest por$ pip install shoop/
Unpacking ./shoop
...
... *** bunch of lines snipped ***
...
Successfully installed Babel Django django-bootstrap3 django-countries django-enumfields django-filer django-jinja django-mptt django-parler django-polymorphic django-registration-redux django-timezone-field djangorestframework factory-boy fake-factory jsonfield Markdown pytz requests six shoop enum34 easy-thumbnails Unidecode jinja2 pillow markupsafe
Cleaning up...
(shooptest)pormb:shooptest por$
Ok! Now we have Shoop installed. The official documentation (at the time of writing) states that "After this, you can begin setting up a Django project using whichever standards you fancy." To me, based on that, it wasn't at all clear on how to proceed. :-)

Setting Up the Project


Without the help of further instructions, I went on the only way I know - by starting a new Django project with django-admin.
(shooptest)pormb:shooptest por$ django-admin startproject shooptest
(shooptest)pormb:shooptest por$ cd shooptest/
Now that the project is ready, our freshly installed Shoop needs to be incorporated into it somehow. Documentations mentions modules shoop.core, shoop.front, and shoop.admin. Shoop.core must be a basic requirement for both modules, and in order for the front to make any sense, I'd imagine Shoop needs to be configured, products established etc. So shoop.admin needs to be configured first. So I fired PyCharm (by far the best Python IDE I've tried, check it out https://www.jetbrains.com/pycharm/) and went on to set up the project.

Basic configuration


As with all Django projects, external modules need to be included in INSTALLED_APPS setting. So went to add modules mentioned earlier in shooptest/settings.py:

# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'shoop.core',
'shoop.admin',
'shoop.front',
)

Now, if you try to migrate the project, an error is displayed:

(shooptest)pormb:shooptest por$ python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/por/Sites/shooptest/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/Users/por/Sites/shooptest/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/Users/por/Sites/shooptest/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/por/Sites/shooptest/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/Users/por/Sites/shooptest/lib/python2.7/site-packages/django/apps/config.py", line 141, in create
    return cls(app_name, app_module)
  File "/Users/por/Sites/shooptest/lib/python2.7/site-packages/shoop/apps/__init__.py", line 113, in __init__
    self._check_required_installed_apps()
  File "/Users/por/Sites/shooptest/lib/python2.7/site-packages/shoop/apps/__init__.py", line 141, in _check_required_installed_apps
    raise ImproperlyConfigured("%s requires the following INSTALLED_APPS: %s" % (self.name, information))
django.core.exceptions.ImproperlyConfigured: shoop.core requires the following INSTALLED_APPS: easy_thumbnails (required), filer (required)
(shooptest)pormb:shooptest por$
Aha! shoop.core requires two additional modules: easy_thumbnails and filer. Let's add them to the installed modules in shooptest/settings.py. In the example below I've also added bootstrap3, which is required by shoop.admin. So instead of looking again at an error like the one above, add it as well.

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'easy_thumbnails',
'filer',
'bootstrap3',
'shoop.core',
'shoop.admin',
'shoop.front',
)


Now that all the required modules are included we should be ready migrate and browse the admin site? Right? Not quite, few things are still missing as indicated by the error.
(shooptest)pormb:shooptest por$ python manage.py migrate
Traceback (most recent call last):
   ...
django.core.exceptions.ImproperlyConfigured: The DjangoTemplates engine was encountered in your template configuration before Django-Jinja. This configuration will not work correctly with Shoop.
(shooptest)pormb:shooptest por$
This is something that bit me. Django-Jinja must be added into TEMPLATES in shooptest/settings.py, and DjangoTemplates must be kept intact. At first I replaced DjangoTemplates with Django-Jinja, and while testing the admin site, I got errors in taxes. So add Django-Jinja before DjangoTemplates:

TEMPLATES = [
{
'BACKEND': 'django_jinja.backend.Jinja2',
'APP_DIRS': True,
'OPTIONS': {
'match_extension': '.jinja',
},
},
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

Okay, that we've cleared that out of the way, can we migrate to set up the database etc?

(shooptest)pormb:shooptest por$ python manage.py migrate

Operations to perform:
  Synchronize unmigrated apps: staticfiles, shoop_admin, messages, bootstrap3
  Apply all migrations: filer, shoop, sessions, admin, shoop_front, auth, contenttypes, easy_thumbnails
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying easy_thumbnails.0001_initial... OK
  Applying easy_thumbnails.0002_thumbnaildimensions... OK
  Applying filer.0001_initial... OK
  Applying filer.0002_auto_20150606_2003... OK
  Applying sessions.0001_initial... OK
  Applying shoop.0001_initial... OK
  Applying shoop_front.0001_initial... OK
(shooptest)pormb:shooptest por$
It seems so - nice! We should be ready to run the development server - but first, we need the admin user.

(shooptest)pormb:shooptest por$ python manage.py createsuperuser

Username (leave blank to use 'por'): admin
Email address:  
Password: 
Password (again): 
Superuser created successfully.
(shooptest)pormb:shooptest por$ python manage.py runserver

Performing system checks...

System check identified no issues (0 silenced).
July 11, 2015 - 19:17:09
Django version 1.8.2, using settings 'shooptest.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Okay, the server is running, but we still need to configure URL routing in order to reach Shoop admin UI. Open up urls.py and add the route for shoop-admin. Please note the required namespace as well. 

from django.conf.urls import include, url
from django.contrib import admin

import shoop.admin.urls

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url( r'^shoop-admin/', include( shoop.admin.urls, namespace = 'shoop_admin' ) ),
]
Now Django should be able to find Shoop's admin UI. Browse to http://127.0.0.1:8000/shoop-admin/ and voilá! You should be greeted by Shoop's login Window.

Shoop Login

Nice!

Final words


Shoop seems to contain a bunch of (undocumented) additional modules. They bring additional options into admin UI. Play around with them and what they do.

# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'bootstrap3',
'easy_thumbnails',
'filer',
#'rest_framework',

'shoop.core',
'shoop.front',
'shoop.admin',
'shoop.addons',
'shoop.apps',
'shoop.default_tax',
'shoop.simple_supplier',
'shoop.simple_cms',
'shoop.simple_pricing',
'shoop.notify',
#'shoop.api',
)







Comments