Installation:

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 minimally containing:

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

where the dict keys match parameter names in the STW documentation:
https://shrinktheweb.com/uploads/PRO_Feature_Documentation.pdf

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.

Add the template to your project's urls.py:
urlpatterns = [url(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):
pip install -r requirements-test.txt
They can be run without setting up a Django project via: python runtests.py
