Skip to main content

No project description provided

Project description



pip install django-cookiebanner


  • Add cookiebanner to your INSTALLED_APPS

  • in your settings ( specify the different Cookie Groups:

from django.utils.translation import gettext_lazy as _

    "title": _("Cookie settings"),
    "header_text": _("We are using cookies on this website. A few are essential, others are not."),
    "footer_text": _("Please accept our cookies"),
    "footer_links": [
        {"title": _("Imprint"), "href": "/imprint"},
        {"title": _("Privacy"), "href": "/privacy"},
    "groups": [
            "id": "essential",
            "name": _("Essential"),
            "description": _("Essential cookies allow this page to work."),
            "cookies": [
                    "pattern": "cookiebanner",
                    "description": _("Meta cookie for the cookies that are set."),
                    "pattern": "csrftoken",
                    "description": _("This cookie prevents Cross-Site-Request-Forgery attacks."),
                    "pattern": "sessionid",
                    "description": _("This cookie is necessary to allow logging in, for example."),
            "id": "analytics",
            "name": _("Analytics"),
            "optional": True,
            "cookies": [
                    "pattern": "_pk_.*",
                    "description": _("Matomo cookie for website analysis."),
  • In your base template add the banner and the conditionals:
{% load cookiebanner %}
{% cookiebanner_modal 'vanilla' %}

{% cookie_accepted 'analytics' as cookie_analytics %}
{% if cookie_analytics %}
<script>... javascript for matomo ...</script>
{% endif %}

Custom Template

You can create a custom template and use that instead of the default one.

  • Create a folder cookiebanner/ and a file in one of your templates/-folders, e.g.: templates/cookiebanner/mytemplate.html
  • Use {% cookiebanner_modal 'mytemplate' %}

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_cookiebanner-0.2.7.tar.gz (19.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page