Django-cookie-policy

A reusable application for managing visitors consent with respect to the cookies law in Django project.

Download as .zip Download as .tar.gz View on GitHub

Django cookie policy

django-cookie-policy is a reusable application for managing visitors consent with respect to the cookies law in Django project. It allows a server side control of all the feature of the website that are cookie-related.

Features

Configuration

  1. Add cookie_policy to your INSTALLED_APPS.

  2. Add django.core.context_processors.request (if it is not already present) and cookie_policy.context_processor.cookie_policy to TEMPLATE_CONTEXT_PROCESSORS.

  3. Include django-cookie-policy urls in urls.py::

    url(r'^cookies/', include('cookie_policy.urls'))

Usage

In order to display the cookie policy banner, just add the following lines to your templates:

{% if not cookie_accepted %}
{% include 'cookie_policy/banner.html' %}
{% endif %}