Installation:

Using easy_install:
easy_install django-stw

Using pip:
pip install django-stw

If you checked out from github:
python setup.py install

Configuration:

1. Add 'stw' to your INSTALLED_APPS tuple.

2. Define a SHRINK_THE_WEB dict in settings.py:

SHRINK_THE_WEB = {
    'stwaccesskeyid' : 'your STW access key id' - required',
}

where the dict keys match parameter names in the STW documentation:
http://www.shrinktheweb.com/content/shrinktheweb-pagepix-documentation.html

django-stw defines a key 'lang' for the SHRINK_THE_WEB dictionary that
can be passed along as a default to the preview tag. Alternately a 'lang'
keyword can be supplied in each template tag invocation. STW defaults it
to 'en'.

If you want to have the same settings for either tag on a site wide
basis you can specify additional STW URL parameters and values
in the settings.SHRINK_THE_WEB_DEFAULTS dictionary. Individual
template tags can then override the default values.

i.e.
SHRINK_THE_WEB = {
    'stwaccesskeyid' : 'your STW access key id' - required',
    'stwdelay' : 10, # wait 10 sec for page to load before STW captures image
    'stwsize' : 'xlrg', # default to xlrg image size
}

then this template tag shortens the delay to 5 sec and adds the stwinside parameter,
the stwsize is taken from the defaults: 'xlrg':
{% stwimage "http://example.com/internalpage.html" "The author website" "stwdelay=5 stwinside=1" %}

Example Site:

The template directory contains a sample template that demonstrates more uses.

Make sure TEMPLATE_LOADERS contains the app_directories template loader:

Django 1.2, 1.3:
'django.template.loaders.app_directories.Loader'

Prior Django releases:
'django.template.loaders.app_directories.load_template_source'

Add the template to your project's urls.py:
urlpatterns = patterns('',
                       (r'^stw/', include('stw.urls')),
                       # the rest of your urls
                       )

Start django server and visit http://localhost:8000/stw/ in your browser to view the page.

Tests:

The tests require the mock package (http://www.voidspace.org.uk/python/mock/mock.html).
They can be run without setting up a Django project using the runtests.py script.
