Skip to main content

A simple Django app to create deep zoom tiled images. Python 2 and pre-Django 1.6 compatible.

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, Microsoft’s SeaDragon deep zoom viewer, and Sean Rice’s JavaScript touch events 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 ReadTheDocs.

Author:David J Cox

Let me know what you think of Django-deepzoom. Share your site (or sites) that use it. I’m curious. Cool.

What’s New?

Django-deepzoom has been ported to Python 3 and Django 1.6. Both ports required introducing backwards-incompatible changes that have been resolved, for now, with separate Django-deepzoom releases. In the future a unified version will be attempted.

Porting to Python 3 involved replacing PIL with Pillow, ensuring uniform Unicode string-handling, converting to new function calls, and updating the test code.

Porting to Django 1.6 mainly involved converting the test code to handle the new default database autocommit behavior. Tests designed to force errors and exceptions had to be wrapped in transaction.atomic() to avoid halting the testrunner.

To accommodate these inflection points, three Django-deepzoom releases are available:

  • Version 0.3 is compatible with Python 2 and Django pre-1.6.
  • Version 0.4 is compatible with Python 2 and Django 1.6+.
  • Version 1.0 is compatible with Python 3 and Django 1.6+.

A summary table is provided in the Quick start section below…

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.


Quick start

Before you begin, choose the Django-deepzoom version that’s compatible with the versions of Python and Django you’re using:

Python Django Django-deepzoom
2 pre-1.6 0.3
2 1.6+ 0.4
3 1.6+ 1.0

1.) Install Django-deepzoom like this:

pip install "django-deepzoom==0.3"

or, like this:

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

2.) Add “deepzoom” to your INSTALLED_APPS setting like this:



3.) 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.

4.) Run python syncdb to create the Django-deepzoom models.

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


from deepzoom.views import deepzoom_view

urlpatterns = patterns('',

6.) 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},

7.) 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 src="{{ STATIC_URL }}js/vendor/seadragon-min.js"></script>

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

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

9.) 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.

10.) 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:



Project details

Release history Release notifications

History Node


History Node


History Node


History Node


History Node


History Node


This version
History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-deepzoom-0.3.tar.gz (415.0 kB) Copy SHA256 hash SHA256 Source None Mar 22, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page