Site Sections: Satchmo Main | Wiki | Demo Store |

Installation Hints

This place is a location for people to consolidate tips and tricks they learn while installing Satchmo. We'll try to incorporate them into the documentation.

SatchmoDependencies

URL Resolver Errors

Sometimes, you'll get a "NoReverseMatch" of other url error that is difficult to diagnose. Here's one hint to learn more about where the error is coming from:

$ ./manage.py shell

Python ...
>> from django.core import urlresolvers
>> urlresolvers.reverse('satchmo_product', None, {'product_slug' : 'foo'})

SSL Redirect Errors

Every once in a while, people have trouble with the ssl redirects not working correctly. This thread describes a situation with Nginx. The solution in this case was to set the nginx config this way

For anybody else who runs into this, here's what that nginx config would look like:

location  ~ ^/shop/checkout {
                rewrite ^/(.*) https://mydomain.com/$1 permanent;
 }

Bad settings.LANGUAGE_CODE

This thread describes the issue

The following command will generate the locale on Unix systems.

sudo locale-gen en_US 

On Windows systems, make sure the LANGUAGE_CODE in your settings.py file is set like this:

LANGUAGE_CODE = 'us'

On one system, the problem was ISO-8859-1 vs. UTF-8. I had UTF-8 but not ISO-8859. Here's what I did to generate it and make everyone happy -

sudo localedef -i en_US -f ISO-8859-1 en_US

Customizing the home page view

Most people will want to customize the objects displayed on the home page. The easiest way to do this is override the urls in your local_settings.py file:

URLS = patterns('',
    (r'^search/$', 'oohga.site.views.do_search', {}, 'satchmo_search'),
    (r'^accounts/login/', 'sss_auth.views.login_signup_address', {}, 'auth_login'),
    (r'^$','oohga.site.views.index_page', {}, 'oohga_home'),
)

Fixing Category Assignment

From the Coder's Eye blog Fixing category assigned with itself as parent

/opt/webapps/mystore $ ./manage.py dbshell
mysql> update product_category set parent_id=null where id=parent_id;
mysql> quit

'comment_utils' is not a valid tag library

Here's the solution James Bennett posted in the mailing list http://groups.google.com/group/satchmo-users/browse_thread/thread/1f54406f819bb10a:

You most likely installed a very recent SVN checkout of comment_utils,
where that tag library has been renamed to avoid an import conflict:

http://code.google.com/p/django-comment-utils/source/detail?r=87 

Checking out revision 86 worked for me.

Another way to get this working is to load moderated_comments instead of comment_utils in mystore/templates/_product_ratings.html. Don't know if there are any other places this should go.

Apache 2 Virtual Host Config

This is what I've used to get Satchmo working with mod_python. It's based on the instructions at http://www.djangoproject.com/documentation/modpython/.

Note the following locations:

  • Project directory: /var/www/mysatchmo
  • Django installation: /usr/src/django_src
<VirtualHost *>
        ServerAdmin administrator@mysatchmo.mysite.com
        ServerName mysatchmo.mysite.com
        DocumentRoot /var/www/mysatchmo/htdocs
        ErrorLog /var/www/mysatchmo/logs/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        PythonDebug On

        CustomLog /var/www/mysatchmo/logs/access.log combined

        <Location "/">
                SetHandler python-program
                PythonHandler django.core.handlers.modpython
                PythonPath "['/var/www/']+sys.path"
                SetEnv DJANGO_SETTINGS_MODULE mysatchmo.settings
        </Location>
        
        Alias /media "/usr/src/django_src/django/contrib/admin/media"
        <Location /media>
                SetHandler None
        </Location>

        Alias /static "/var/www/mysatchmo/static"
        <Location /static>
                SetHandler None
        </Location>

        <LocationMatch "\.(jpg|gif|png)$">
                SetHandler None
        </LocationMatch>

</VirtualHost>

Using the right owner and group and permissions for your file

Otherwise you will have to face to permissions problems, for example with Apache mod_python ([ERRNO 13])

# With Apache group = "www.data"
chown -R yourusername.www-data /path/to/your/djangoproject
chmod -R g+w /path/to/your/djangoproject

Quick Satchmo

There is an attempt to provide a quick and easy installation.

http://code.google.com/p/quicksatchmo/

Just put your DB settins in qs_settings and run quick_satchmo.py. The script will create the default store provided in the official documentation.

Getting the i18n context

You'll need to add this line in your TEMPLATE_CONTEXT_PROCESSORS (in settings.py):

'django.core.context_processors.i18n',

An example of this is to populate the {{ LANGUAGE_CODE }} tag in Satchmo's templates, base.html in particular on line 3:

<html xmlns="http://www.w3.org/1999/xhtml"
lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" 
{% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>

Otherwhise it will stay blank, and not validate.

Make the switch from local development to server production easy

Make a re-use of the LOCAL_DEV and DIRNAME variables in settings.py/loc_settings.py

LOCAL_DEV = True
DIRNAME = os.path.abspath(os.path.dirname(__file__))

# Assuming you are usig a file based database such as sqlite3
# and you want to store it at the root of your project
DATABASE_NAME = os.path.join(DIRNAME, 'mysite.db') # Or path to database file if using sqlite3.


if LOCAL_DEV:
    MEDIA_URL = 'http://127.0.0.1:8000/static/'
else:
    MEDIA_URL = 'http://mysite.com/static/'

# Assuming you made a copy of the locale path into your project directory
LOCALE_PATHS = "os.path.join(DIRNAME, 'locale')"

Then you will just have to switch LOCAL_DEV to False on the production server. Don't forget to configure your production server correctly. See Apache2VirtualHostConfig if you are an Apache user.