Skip to main content

Django Dump & Die

PyPI Python Versions Django Versions Ruff Run Tests Coverage Status Documentation Status GitHub PyPI Downloads per Month

Django-Dump-Die is a Django app that provides a couple of debug tools, in the form of built-in methods dump and dd. These allow sending details about a variable to the browser for inspection.

Dumped variables are presented in an easy-to-read and fully expandable/collapsible tree. You can easily understand complex objects and the results of Django queries with a simple call to either method.

When dump and/or dd are called, dump die will intercept the page response and replace the contents of the response with detailed information about the corresponding variables passed for inspection.

The entire concept is heavily based on the dump die functionality that comes with PHP's Laravel and Symfony frameworks.

Full documentation on ReadTheDocs, including the Version History of what changed in each release.

dd_sample_output

Quickstart

  1. Install the Django App via Pypi.
    python -m pip install django-dump-die
    

  1. Add the corresponding app to your Django settings.py file:
    INSTALLED_APPS = [
    
        'django_dump_die',
        ...
    ]
    

  1. Add the corresponding middleware to your Django settings.py file:

    MIDDLEWARE = [
    
        'django_dump_die.middleware.DumpAndDieMiddleware',
        ...
    ]
    
  2. Ensure that you have DEBUG set to True in your Django settings.py file:

    DEBUG = True
    

    ℹ️ NOTE Neither the dump command nor the dd command will do anything if DEBUG is not set to True. With that said, this is a tool for debugging. You should not include this package in production nor should you ever have DEBUG set to True in production. See Security for what to watch out for while using it.


  3. From a file that is part of the request-response cycle such as a Django View in views.py, make a call to dd passing it a variable to inspect.

    views.py

    def my_awesome_view(request):
        dd(request)
    

Usage

The middleware is where most of this package's heavy lifting happens.

By having the middleware installed, you can run dump(<variable>) and/or dd(<variable>) in any file that is part of the request-response cycle, and it will run the dump logic. No importing or extra logic is required.

Each dump(<variable>) command will add the passed object to an internal list that will be dumped either when a dd(<variable>) is used, or if the entirety of the request finishes. You can have as many dump(<variable>) statements as you want leading up to an optional dd(<variable>).

If you make a call to dd(<variable>), execution will immediately stop and all dumped objects (including the one sent to dd) will be output.

If you do not make a call to dd(<variable>) and only use dump(<variable>) statements, the request will continue processing until it is time to return the response. At this point, Django-Dump-Die will intercept and replace the response with the data that has been dumped thus far.

To keep the page and show the dumps above its own content instead, set DJANGO_DD_SHOW_DUMPS_ABOVE_PAGE to True. This only works for HTML pages. Other responses, such as JSON, files, and redirects, are still replaced by the dumps.

If the request raises an unhandled exception, the dumps from before the exception are shown above Django's error page, so that you see both. See DJANGO_DD_SHOW_DUMPS_ON_ERROR_PAGE to turn this off.

Outside of a request, such as in a management command, the shell, or a background task, there is no page to show dumps on. There, dump() prints the object to the console as an indented tree, with the same limits, hidden sensitive values, and colors as the dump page, and dd() prints it and then stops by raising an exception. See ReadTheDocs/Usage.

The middleware supports both sync and async requests, so dump() and dd() work the same in sync and async views.

A dumped model instance shows its relations in their own section: foreign keys and one-to-one fields are followed up to three relations away, and many-to-many fields and reverse relations, such as user_set, show the rows prefetch_related() already loaded. Other relations say they aren't loaded, and how to load them. See ReadTheDocs/Usage.


Example:

# Sample classes for output.
class EmptyClass:
    """Empty Class."""
    pass


class SomeClass:
    """Some Class."""
    SAMPLE_CONST = 41

    def __init__(self, *args, **kwargs):
        self.my_number = 32
        self.my_string = 'A super cool string'
        self.works = True
        self.nothing = None
        self.bytes = bytes('My Bytes', 'utf-8')
        self.list_o_stuff = ['A', 'B', 'C']
        self.sample_set = {'A', 'B', 'C'}
        self.sample_tuple = ('A', 12, True)
        self.empty_class = EmptyClass()
        self.empty_class_dup = self.empty_class

    def do_work(self):
        """Do some work"""
        return True


# Example Usage
empty_class = EmptyClass()
some_class = SomeClass()

dump('Simple String')
dump(empty_class)
dd(some_class)

django-dump-die-sample-output



ℹ️ NOTE Most editors will give a red error squiggle for the dd command. This is intentional, and the command will still run. This is because this command is meant to be used for debugging, and is not meant to stay long-term. The red squiggle helps identify it as something that should be removed before any actual commits.


Usage & Parameters

For further documentation on usage and parameters, see ReadTheDocs/Usage

Configuration

The package has a few available configuration options and settings, which are documented at ReadTheDocs/Configuration

Metadata

Release files for django-dump-die 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-dump-die 0.3.0
File Size Uploaded Provenance Actions
django_dump_die-0.3.0.tar.gz 67.3 kB With provenance Details for django_dump_die-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-dump-die 0.3.0
File Interpreter ABI Platform Actions
django_dump_die-0.3.0-py3-none-any.whl Python 3 none any Details for django_dump_die-0.3.0-py3-none-any.whl

Total release size: 144.7 kB

Release files / django_dump_die-0.3.0.tar.gz

Download URL django_dump_die-0.3.0.tar.gz
Size 67.3 kB
Tags Source
SHA-256 checksum
How to use checksums
63b1a46a299f72fe1bb9e206b5d5578909b4f3b521a6031a8bb342c5eb7a65d9
BLAKE2b-256 checksum
How to use checksums
56be432aabae29fc4df3c9cf729fa22a828e5efee97095c055d2f4c41fbd2a15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / django_dump_die-0.3.0-py3-none-any.whl

Download URL django_dump_die-0.3.0-py3-none-any.whl
Size 77.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca2124a629b27e9a64fff8f384683516216ce8fbe0ac8eb88a15a197396bb719
BLAKE2b-256 checksum
How to use checksums
b67621e9456b80f5e762df8ec597258f7a3e262c32f974049f7cda625d9ac6fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for django-dump-die 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_dump_die-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page