Skip to main content

Django Cookie Filter

Django middleware which removes all unwanted cookies - useful for improving cache hit ratios when analytics cookies interfere with caching.

Installation

Using pip:

$ pip install django-cookiefilter

Edit your Django project's settings module, and add the middleware to the start of MIDDLEWARE:

MIDDLEWARE = [
    "cookiefilter.middleware.CookieFilterMiddleware",
    # ...
]

[!NOTE] The middleware should be added before UpdateCacheMiddleware, as it uses the value of HTTP_COOKIES which needs to be modified.

Configuration

Out of the box the standard Django cookie names will work without any other configuration. However if your project uses different or additional cookie names, edit COOKIEFILTER_ALLOWED in your project's settings module:

COOKIEFILTER_ALLOWED = [
    "analytics",
    "csrftoken",
    "django_language",
    "messages",
    "sessionid",
]

Metadata

Release files for django-cookiefilter 1.2

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-cookiefilter 1.2
File Size Uploaded
django_cookiefilter-1.2.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-cookiefilter 1.2
File Interpreter ABI Platform
django_cookiefilter-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / django_cookiefilter-1.2.tar.gz

Download URL django_cookiefilter-1.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6cb15bfed937cd4e82c75385b8e84a043b4bfef3a85a1158d7ec5f487fb3f912
BLAKE2b-256 checksum
How to use checksums
ba9ab92c9dd2d3d3606802d62b75a3b69287dfbcce9924a8f66a2999c8bd9953
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 27, 2026.

Transparency log

Release files / django_cookiefilter-1.2-py3-none-any.whl

Download URL django_cookiefilter-1.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cc3e83c336569d49859f1060f030c0a717f1a42723e2c7c18f320d2827ae95a
BLAKE2b-256 checksum
How to use checksums
466bdc7b60c7a099d51fd6a8afc51e936e6e6db39010c3ee3896dfffe838ee9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0

2 release files

0.1

2 release files

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