Quickstart

Installation

Install django-cookie-consent from PyPI with pip (recommended):

pip install django-cookie-consent

Alternatively, you can install directly from Github:

pip install git+https://github.com/jazzband/django-cookie-consent@master#egg=django-cookie-consent

Warning

Installing from the master branch can be unstable. It is recommended to pin your installation to a specific git tag or commit.

Configuration

  1. Add cookie_consent to your INSTALLED_APPS.

  2. Add django.template.context_processors.request to TEMPLATE_CONTEXT_PROCESSORS if it is not already added.

  3. Include django-cookie-consent urls in urls.py

    from django.urls import path
    
    urlpatterns = [
        ...,
        path("cookies/", include("cookie_consent.urls")),
        ...,
    ]
    
  4. Run the migrate management command to update your database tables:

    python manage.py migrate