Site Sections: Satchmo Main | Wiki | Demo Store |

Multiple Satchmo shops with a single installation

Multi shop has been merged to Satchmo trunk. This page is for reference use only.

Introduction

dimitern: Hello, my name is Dimiter Naydenov and I recently discovered Satchmo. We are building a large web-portal which needs to provide the functionallity of an electronic mall. For this, we need a way to use the new features of the multi-shop branch. So, I created this page with the hope to gather all the information needed for folks with similar requirements like us. I'm a Python developer and I'm very eager to contribute to the project and develop solutions, based on Satchmo. Please, feel free to reorganize this page as you think it will be more useful. I'll try to keep the page updated, as I get deeper into the code and common usage patterns.

In a nutshell: Bruce Kroeze said:

I am going to begin work on a short (hopefully) branch this weekend.
"multi-shop" will fully enable multiple shops within one installation.

- It will support multiple hosts, as well as "sub-shops":

multiple hosts: shirts.example.com, books.example.com
sub-shops: mall.example.com/shirts, mall.example.com/trousers 

multi-shop Development

Currently bkroeze is working on implementing functionality. I'll try to keep this page updated as the progress goes on in this branch.

Related tickets:

  • #502 - Require authentication to checkout (optionally)
  • #501 - missing ugettext import
  • #500 - IntegrityError: contact_addressbook.country_id may not be NULL
  • #499 - Refactoring contacts model breaks loading of fixtures with sample data
  • #498 - New password reset solution in Django is not handled by Satchmo
  • #497 - shop.views.cart.set_quantity should be redirecting
  • #496 - New signals allowing extension of product models using external objects
  • #495 - [multi-shop] Path handling in ImageWithThumbnailField is broken after FileField API change in Django
  • #494 - [multi-shop] ImportError on ugettext which is not imported
  • #493 - thumbnails do not work with new ImageFields
  • #492 - MultihostNotReady exception raised in satchmo/shop/models.py
  • #491 - TemplateSyntaxError due to an incorrect signal handler
  • #490 - ImproperlyConfigured: The model Cart is already registered
  • #489 - TemplateSyntaxError: 'comment_utils' is not a valid tag library
  • #486 - ImportError related to 'syncdb' occuring twice in multi-shop on startup

Related changesets:

  • [1417] - adding site sidebar to settings page
  • [1414] - removed all reliance on threaded_multihost for non-multihost operation
  • [1412] - payment tests now work
  • [1411] - wishlist and giftcertificate tests now pass
  • [1410] - discount and contact tests are clean
  • [1409] - almost all shop tests now pass
  • [1407] - Updates models and views to use new, cleaner country handling. Thanks for the patch, emes. Closes #500.
  • [1406] - fixes loading, closes #499
  • [1405] - extending contact model to handle more situations, thanks to Jag for the contribution. Also fixes improper product inventory handling, moving to model from view.
  • [1404] - fixing load_data.py for new site fields
  • [1403] - removing import admin
  • [1402] - imagefield fixes for django trunk. Thanks, Jag
  • [1401] - partial conversion to new ImageField?
  • [1400] - Changed cart add_order to throw an error when it can't add, giving the …
  • [1399] - using newforms admin to provide initial dimension unit data.
  • [1398] - adding default shop config for tests
  • [1397] - shipping tests now pass
  • [1396] - product tests now pass
  • [1395] - payment tests now pass
  • [1394] - giftcertificate tests now pass
  • [1393] - Configuration tests now passgiftcertificate tests now pass
  • [1392] - added tearDown functions to tests to clear out cache by default. Tax …
  • [1391] - found another reference to removed syncdb util
  • [1390] - shop tests pass, removed reference to syncdb util, closes #486
  • [1389] - added missing parameter to cache call
  • [1388] - updated to use Config manager rather than a class method
  • [1386] - updating for new signals in Django 1.0
  • [1382] - fixing startup problems
  • [1381] - merged from trunk to multi-shop revs 1363:1380
  • [1380] - added new custom fields
  • [1378] - fixing bad imports due to moving of order into shop
  • [1377] - removed improper imports of config
  • [1376] - first version of multi-shop which passes syncdb
  • [1365] - contacts converted to multi-site
  • [1363] - branched multi-shop

Related satchmo-developers posts:

Required Django patches:

  • Django ticket #7947 and its patch, allowing to edit OneToOne fields. Until merged, this patch must be manually applied to Django trunk for the multi-shop functionality to work as expected. NOTE: This patch was merged as of Version 8469

Installation

Debian/Ubuntu

I have prepared a setup script to simplify the installation and upgrade of all the required libraries. You'll need sudo permissions to execute it. It installs all the required packages system-wide and then gets Django, Satchmo (multi-shop branch) and other dependencies from the latest source.

  1. Get the setup_satchmo_multi-shop.sh and save it somewhere, e.g. /home/user/
  2. Execute:
    chmod +x /home/user/setup_satchmo_multi-shop.sh
    
  3. Run it like this:
    . /home/user/setup_satchmo_multi-shop.sh -p /home/user/src -q
    
    This makes /home/user/src/ the installation directory (the default it is $PWD/lib) and performs the required operations automatically (-q means 'quiet')
  4. After everything passes OK, the script have set PYTHONPATH and PATH as needed. We assume you want to start a new project, using Satchmo multi-shop. Run:
    cd /home/user
    django-admin.py startproject multi_shop
    cd multi_shop
    
  5. Now copy and customize the settings and urls:
    cp ../src/satchmo/settings-customize.py settings.py
    cp ../src/satchmo/local_settings-customize.py local_settings.py
    cp ../src/satchmo/urls.py urls.py
    
    For simplicity, we will use sqlite3 database. So edit local_settings.py and add the following 4 lines just above #Configure logging line:
    # LOCALE_PATHS = ""
    
    DATABASE_ENGINE = 'sqlite3'
    DATABASE_NAME = 'multi_shop'
    ROOT_URLCONF = 'multi_shop.urls'
    SITE_DOMAIN = 'localhost'
    SECRET_KEY = 'my-very-secret-key'
    
    #Configure logging
    
    Please, note that you'll need to use your own value of SECRET_KEY!
  6. Copy the required customizable files:
    python manage.py satchmo_copy_static
    python manage.py satchmo_copy_templates
    
  7. Verify you configuration and create the database:
    python manage.py satchmo_check
    python manage.py syncdb
    
    There should be no errors. If there are, please search the wiki, add a comment/update this page or post a ticket.
  8. Load sample shop data:
    python manage.py satchmo_load_l10n
    python manage.py satchmo_load_store
    python manage.py satchmo_load_us_tax
    
  9. Run the development server:
    python manage.py runserver
    
  10. Go to http://localhost:8000/shop/ and start using the shop.

Others

The above script can be easily modified to support other Linux distributions or cygwin under Windows. You just need to install the required packages (see install_python_and_stuff() bash function), using your native package manager application. Please, feel free to contribute your comments and modifications of the script.

Attachments