Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Simple Request/SQL profiling for Django

Project Description

Django Snoopy is a pluggable profiling tool for Django Apps

Quick Start

  1. Add snoopy.middleware.SnoopyProfilerMiddleware to MIDDLEWARE_CLASSES
  2. (Optional) Configure Output if you don’t want to use the default log file output
  3. Profile your code!

Setting Custom Attributes:

In case you want to track something specific to your app, you can do this:

from snoopy.request import SnoopyRequest SnoopyRequest.record_custom_attributes({‘key’: ‘value’})

Any value set twice will just be overridden.

IMPORTANT: The data passed into this MUST be a JSON serializable dictionary.


You can set these in your Django file to configure how Snoopy works

  • Track all SQL queries done via the Django ORM
SNOOPY_OUTPUT_CLASS: ‘snoopy.output.LogOutput’
  • Set the class that defines how the collected info is processed at the end of the request. The options available out of the box are:
    • snoopy.output.LogOutput: This will create a file for each request in the folder specified by SNOOPY_LOG_OUTPUT_DIR. Defaults to the root folder of the app
    • snoopy.output.HTTPOutput: This will make a JSON formatted HTTP POST with the data in SNOOPY_HTTP_OUTPUT_URL
  • You can write your own Output class. All you need to do is to extend snoopy.output.OutputBase and implement the save_request_data method.
  • Set to True if you want profiling
  • If this option is set to False, django-snoopy will take the parent directory of the main django settings file as the project root and will only list items in the cProfile output that are files under this directory (your actual app code)
  • Set to True if you want to use the built-in profiler/tracer
  • Like the cProfile option counterpart, allows you to specify if you want data about all or just your own code.

Release History

This version
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.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(6.6 kB) Copy SHA256 Hash SHA256
Source Mar 6, 2016

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