Skip to main content

Django utilities for honoring the Do Not Track HTTP header.

Project description

Build status

Django utilities for honoring the Do Not Track HTTP header.

Mathieu Leplatre posted an article Django: Do not forget Do Not Track. I really appreciated the post, and wanted to implement the ideas in my projects. Being lazy, I only wanted to do the work once, so I took his ideas and packaged them up with some tests and docs.

Included is middleware for detecting HTTP_DNT and passing its information on to both views and templates via the request object, and a useful context processor. The middleware also adds a vary header for cache control.

This package requires Python 2.7 or newer and Django 1.4 or later.

Refer to the documentation for complete information.

Quick-Start

Installation of the middleware is required. The context processor is convenient and thus recommended.

Settings:

MIDDLEWARE_CLASSES = (
    # default/other processors ...
    'donottrack.middleware.DoNotTrackMiddleware',
    # default/other processors ...
)

TEMPLATE_CONTEXT_PROCESSORS = (
    # default/other processors ...
    'donottrack.context_processors.donottrack',
)

Then in your template you can do things like:

{% if not donottrack %}
    {% include "google-analyitcs.html" %}
{% endif %}

And your views can also handle DNT:

def my_view(request):
    if not request.donottrack:
        # Log some request data ...

    # continue with view logic

Other Information

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

django-donottrack-0.1.tar.gz (12.1 kB view details)

Uploaded Source

File details

Details for the file django-donottrack-0.1.tar.gz.

File metadata

File hashes

Hashes for django-donottrack-0.1.tar.gz
Algorithm Hash digest
SHA256 44e18a0699984d35d626129c92d7af663c581491f9ec86937339fd9914e06bb1
MD5 e84ee9945a5e2c575549f770f162dfcf
BLAKE2b-256 685d11f52779d9aea936d67ed44ee82fe69692e37db5a8f6e868bb51f3465b9f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page