Skip to main content

Django Cookie Filter

Project description

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",
]

Project details


Download files

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

Source Distribution

django_cookiefilter-1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_cookiefilter-1.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file django_cookiefilter-1.1.tar.gz.

File metadata

  • Download URL: django_cookiefilter-1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for django_cookiefilter-1.1.tar.gz
Algorithm Hash digest
SHA256 5687e6b9839a5829a36d8bc54be2d8334867a986b0bb7ede8ad421964f350483
MD5 29d656487948ab13dce4e82435df7c38
BLAKE2b-256 8543d44f15aedfe9bb98e0812a9fc8a496e252b485143b8da8b8df6c53343d87

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cookiefilter-1.1.tar.gz:

Publisher: publish.yml on developersociety/django-cookiefilter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_cookiefilter-1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cookiefilter-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 855d2b6d5e8f670616bad4be9101ac2ed62d540b420676289af6aed9cd4c1b84
MD5 ee9f66e3b82e60c1a3ee7044f85d09e8
BLAKE2b-256 7c9739e1818c4007989c8895a443795ce28e3c1ef5e097f798208ad534445f9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cookiefilter-1.1-py3-none-any.whl:

Publisher: publish.yml on developersociety/django-cookiefilter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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