Skip to main content

Cookie consent component for any Django web-site

Project description

Cookie consent

Cookie consent is a Django app to show consent component for web-cookies.

Quick start

  1. Add "cookie_consent" in your settings.py:
    ...
    INSTALLED_APPS = [
        ...,
        "cookie_consent",
        ...,
    ]
    ...
  1. Include the url config like this:
    path("cookie_consent/", include("cookie_consent.urls")),
  1. Run python manage.py migrate cookie_consent to create the models.
  2. Include consent template in your web-site templates.

For example, I've included the following near the end of my base template:

{% block cookie_consent %}
  <link rel="stylesheet" href="{% static 'cookie_consent/css/index.css' %}">
  {% include 'cookie_consent/includes/consent.html' with consent_text='We use cookies to understand your interactions with this web-site.' %}
  {# the default for `consent_text` is 'We are using cookies to make this website fully functional.' #}
  <script defer src="{% static 'cookie_consent/js/main.js' %}"></script>
{% endblock %}

Don't forget to serve that script and css files! You can find them in distribution, css and js are in both source and compiled forms and are fine (as long as you run collectstatic command).

  1. Start the development server and visit necessary pages.

Coming up next

  • Automated testing

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_cookie_consent_gutsh-1.1.7.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

django_cookie_consent_gutsh-1.1.7-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

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