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.2.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.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for django_cookiefilter-1.2.tar.gz
Algorithm Hash digest
SHA256 6cb15bfed937cd4e82c75385b8e84a043b4bfef3a85a1158d7ec5f487fb3f912
MD5 a31715c2de8af977ede9f06c82dd5734
BLAKE2b-256 ba9ab92c9dd2d3d3606802d62b75a3b69287dfbcce9924a8f66a2999c8bd9953

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cookiefilter-1.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cookiefilter-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3cc3e83c336569d49859f1060f030c0a717f1a42723e2c7c18f320d2827ae95a
MD5 8cbb90bff8eb978a9eaae3828d4c53af
BLAKE2b-256 466bdc7b60c7a099d51fd6a8afc51e936e6e6db39010c3ee3896dfffe838ee9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_cookiefilter-1.2-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