This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A simple Django app to create deep zoom tiled images.

Project Description

Django-deepzoom is a drop-in Django app for the creation and use of Deep Zoom tiled images. It handily integrates Daniel Gasienica’s and Kapil Thangavelu’s image generator and the OpenSeadragon deep zoom viewer into a set of model classes and template tags which programmatically generate tiled images and all JavaScript necessary for their instantiation into templates.

Detailed documentation is available on

Author:David J Cox

Let me know what you think of it…

What’s New?

Django-deepzoom 3.0 involves major architectural changes so a major version bump is necessary. It introduces signal-based save, a new DEFAULT_CREATE_DEEPZOOM_OPTION setting, better file management, and decoupled file locations. It continues to be Python 2/3 compatible, Django 1.4+ compatible, and Pillow 1.7.8+ compatible.

Signal-based save: Save/update code has been completely removed from model save/delete methods and distributed amongst signal handler methods. This was done to improve inter-model coordination and to beter manage state transitions during field updates. Fields that could not be updated before, e.g. UploadedImage.uploaded_image now are handled in the expected way. If an entirely new image is uploaded to an existing UploadedImage subclass and is saved, the previous uploaded_image will be deleted, the previous associated deepzoom will be deleted, the new uploaded image saved to disk, and an entirely new deepzoom will be generated from the new image.

New DEFAULT_CREATE_DEEPZOOM_OPTION setting: The default value of the create_deepzoom field can be controlled globally by setting the DEFAULT_CREATE_DEEPZOOM_OPTION to True or False. New instances of a UploadedImage subclass will be set to always create a deepzoom or never to create a deepzoom.

Better file management: Instead of relying on the default Django file management policy of ‘never delete/always save’, instance saves, updates, and deletes now involve corresponding file behavior to keep the file system free from overflowing.

Decoupled file locations: File locations saved to instances are now computed and saved relative to MEDIA_ROOT instead of being absolute file paths.

Run tests

After django-deepzoom has been installed, you may want to sanity check it by running tests, like this:

python test deepzoom --settings=deepzoom.test.test_settings


Some of the negative tests are intended to throw exceptions. The error text will display mixed in with the test results. THAT IS EXPECTED!

If the end result is OK then all tests have passed. Enjoy.

Quick start

1.) Install “django-deepzoom” like this:

pip install -U django-deepzoom

or, like this:

tar -xvf django-deepzoom-3.0.3.tar.gz
cd django-deepzoom-3.0.3
python install

2.) Add “deepzoom” to your INSTALLED_APPS setting. Django 1.7 introduced the AppConfig.ready() entry point for app intialization which is needed for the new signals design (in that version of Django). That means the django-deepzoom app needs to be specified one way in Django 1.7+ and the traditional way in previous Django versions. In Django 1.7+ add the app like this:



However, in Django 1.6 and before, add the app the traditional way, like this:



3.) Add a logging configuration to your file, like this:

    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file': {
            'level': 'ERROR',
            'class': 'logging.FileHandler',
            'filename': 'deepzoom.exception.log',
    'loggers': {
        'deepzoom.models': {
            'handlers': ['file'],
            'level': 'ERROR',
            'propagate': True,

4.) Sub-class the ‘UploadedImage’ model class as your own (image-based) class, something like this:


from deepzoom.models import DeepZoom, UploadedImage

class MyImage(UploadedImage):
    Overrides UploadedImage base class.

5.) Import If using Django 1.6 or before, the signals module must be imported after the model definitions have been parsed. This means the import statement must either be added to the end of the file or in the app file. The former avoids breaking test coverage, so may be preferable. Django 1.7+ does not require importing because that is handled by the AppConfig.ready() method. Import the file, like this:


model definitions...

import deepzoom.signals

6.) Run python syncdb to create the django-deepzoom models.

7.) Add an appropriate URL to your Urlconf, something like this:


from deepzoom.views import deepzoom_view

urlpatterns = patterns('',

8.) Write a view that queries for a specific DeepZoom object and passes it to a template, something like this:


from deepzoom.models import DeepZoom

def deepzoom_view(request, passed_slug=None):
      _deepzoom_obj = DeepZoom.objects.get(slug=passed_slug)
  except DeepZoom.DoesNotExist:
      raise Http404
  return render_to_response('deepzoom.html',
                            {'deepzoom_obj': _deepzoom_obj},

9.) In your template, create an empty div with a unique ID. Load the deepzoom tags and pass the deepzoom object and deepzoom div ID to the template tag inside a <script> block in the body like this:

(in e.g. deepzoom.html)

{% extends "base.html" %}

{% load deepzoom_tags %}

<div id="deepzoom_div"></div>

<script>{% deepzoom_js deepzoom_obj "deepzoom_div" %}</script>

10.) Run python collectstatic to collect your static files into STATIC_ROOT.

11.) Start the development server and visit to upload an image to the associated model (you’ll need the Admin app enabled). Be sure to check the Generate deep zoom? checkbox for that image before saving it.

12.) Navigate to the page containing the deep zoom image and either click/touch it or click/touch the overlaid controls to zoom into and out of the tiled image.



Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_deepzoom-3.0.3-py3-none-any.whl (526.4 kB) Copy SHA256 Checksum SHA256 py3 Wheel May 24, 2015
django-deepzoom-3.0.3.tar.gz (479.3 kB) Copy SHA256 Checksum SHA256 Source May 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting