{"id":21919457,"url":"https://github.com/dlrsp/django-iubenda","last_synced_at":"2025-04-19T12:28:05.766Z","repository":{"id":185811232,"uuid":"632623035","full_name":"DLRSP/django-iubenda","owner":"DLRSP","description":"Django application for privacy and cookies policy managed by Iubenda.","archived":false,"fork":false,"pushed_at":"2024-11-12T08:01:12.000Z","size":1361,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-12T09:17:59.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dlrsp.github.io/django-iubenda/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DLRSP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-25T19:45:06.000Z","updated_at":"2024-10-28T20:17:17.000Z","dependencies_parsed_at":"2023-09-22T17:35:35.612Z","dependency_job_id":"ae3d4469-6a8b-4c0b-8ee9-33465ae13d4b","html_url":"https://github.com/DLRSP/django-iubenda","commit_stats":null,"previous_names":["dlrsp/django-iubenda"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DLRSP%2Fdjango-iubenda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DLRSP%2Fdjango-iubenda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DLRSP%2Fdjango-iubenda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DLRSP%2Fdjango-iubenda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DLRSP","download_url":"https://codeload.github.com/DLRSP/django-iubenda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226979180,"owners_count":17712574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T20:08:02.970Z","updated_at":"2024-11-28T20:08:03.954Z","avatar_url":"https://github.com/DLRSP.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-iubenda [![PyPi license](https://img.shields.io/pypi/l/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)\n\n[![PyPi status](https://img.shields.io/pypi/status/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)\n[![PyPi version](https://img.shields.io/pypi/v/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)\n[![PyPi python version](https://img.shields.io/pypi/pyversions/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)\n[![PyPi downloads](https://img.shields.io/pypi/dm/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)\n[![PyPi downloads](https://img.shields.io/pypi/dw/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)\n[![PyPi downloads](https://img.shields.io/pypi/dd/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)\n\n## GitHub ![GitHub release](https://img.shields.io/github/tag/DLRSP/django-iubenda.svg) ![GitHub release](https://img.shields.io/github/release/DLRSP/django-iubenda.svg)\n\n## Test [![codecov.io](https://codecov.io/github/DLRSP/django-iubenda/coverage.svg?branch=main)](https://codecov.io/github/DLRSP/django-iubenda?branch=main) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/DLRSP/django-iubenda/main.svg)](https://results.pre-commit.ci/latest/github/DLRSP/django-iubenda/main) [![gitthub.com](https://github.com/DLRSP/django-iubenda/actions/workflows/ci.yaml/badge.svg)](https://github.com/DLRSP/django-iubenda/actions/workflows/ci.yaml)\n\n## Compliance for websites and apps\nClick [here](http://iubenda.refr.cc/dlrspapi) and get 10% discount on first year at Iubenda\n[![Iubenda](https://client-assets.referralcandy.com/md6Y46jBT5ufTCO2zzGt_1668598186.png)](http://iubenda.refr.cc/dlrspapi)\n\n\n## Check Demo Project\n* Check the demo repo on [GitHub](https://github.com/DLRSP/example/tree/django-iubenda)\n\n## Requirements\n-   Python +3.8 supported.\n-   Django +3.2 supported.\n\n## Setup\n1. Install from **pip**:\n   ```shell\n   pip install django-iubenda\n   ```\n2. Modify `settings.py` by adding the app to `INSTALLED_APPS`:\n   ```python\n   INSTALLED_APPS = (\n       \"modeltranslation\",\n       # ...\n       \"iubenda\",\n       # ...\n   )\n   ```\n3. Modify `settings.py` by adding the app's context processor to `TEMPLATES`:\n   ```python\n   TEMPLATES = [\n       {\n           # ...\n           \"OPTIONS\": {\n               \"context_processors\": [\n                   # ...\n                   \"iubenda.context_processors.iubenda\",\n                   # ...\n               ],\n           },\n       },\n   ]\n   ```\n4. Be sure the Django's Locale middleware is enabled inside `settings.py`:\n   ```python\n   MIDDLEWARE = (\n       # ...\n       \"django.middleware.locale.LocaleMiddleware\",\n       # ...\n   )\n   ```\n5. Optionally, but sugguested, the Django's Current Site middleware is enabled inside `settings.py`:\n   ```python\n   MIDDLEWARE = (\n       # ...\n       \"django.contrib.sites.middleware.CurrentSiteMiddleware\",\n       # ...\n   )\n   ```\n6. Modify `url.py` by adding the app's urls to `urlpatterns`:\n   ```python\n   urlpatterns += [\n       path(\"\", include(\"iubenda.urls\")),\n   ]\n   ```\n7. Modify `url.py` by adding the app's sitemaps to `sitemaps`:\n   ```python\n   from iubenda.sitemaps import PrivacySitemap, CookieSitemap\n\n   sitemaps = {\n       # ...\n       \"privacy\": PrivacySitemap,\n       \"cookie\": CookieSitemap,\n       # ...\n   }\n   ```\n8. Be sure the variable `LANGUAGE_CODE` is available for HTML templates:\n   ```html\n   {% load i18n %}\n   {% get_current_language as LANGUAGE_CODE %}\n   ```\n9. Modify your project's template to add privacy and cookie policies.\n   For example inside the `footer.html` add following code:\n   ```html\n   {% if not debug %}\n       {% block iubenda %}{% include \"iubenda/include-content.html\" %}{% endblock iubenda %}\n   {% endif %}\n   ```\n\n## Optional\n\n### Autoblocking\nIf Iubenda autoblocking's configurations are implemented in your account,\nthe variable `IUBENDA_AUTOBLOCKING` can be set to import the site's script.\n```html\n\u003cscript src=\"https://cs.iubenda.com/autoblocking/{{ cx_iubenda.iub_site_id }}.js\"\u003e\u003c/script\u003e\n```\n\n### Content Security Policy\nIf Content Security Policy are implemented in your server and inline scripts are disabled,\nthe variable `IUBENDA_CSP_NONCE` can be set with nonce tag will be inserted script's nonce.\n```html\n\u003cscript {% if cx_iubenda_nonce %}nonce=\"{{ cx_iubenda_nonce }}\"{% endif %}\u003e\n```\nInside your webserver's configurations, a rule to dynamically replace your CONSTANT nonce in a random string is needed.\n\nTo allow  external source from Iubenda domains, please implement these rules:\n```editorconfig\nContent-Security-Policy:\n    script-src-elem https://*.iubenda.com\";\n    img-src https://*.iubenda.com data:\";\n    style-src https://*.iubenda.com\";\n    connect-src https://*.iubenda.com\";\n    frame-src https://*.iubenda.com\";\n```\n\nIf you prefer to not allow ***unsafe-inline*** inside your CSP, please also add the two specific hash for your\nscript prompted as error in Javascript Console.\n```editorconfig\n# Iubenda Privacy And Cookie Policy - API\nContent-Security-Policy:\n    ...\n    script-src-elem https://*.iubenda.com 'sha256-YOUR-FIRST-HASH-PROMPTED-INSIDE-CONSOLE' 'sha256-YOUR-SECOND-HASH-PROMPTED-INSIDE-CONSOLE';\n    ...\n```\n\nCheck this article from [Iubenda help](https://www.iubenda.com/it/help/12347-come-configurare-il-content-security-policy-per-consentire-lesecuzione-degli-script-di-iubenda)\n\n### Iubenda's Options\n\nTo personalize the Iubenda script's behaviour, the dict `IUBENDA_OPTIONS` can be configured inside `settings.py`\n```python\nIUBENDA_OPTIONS = {\n    \"countryDetection\": \"true\",\n    \"askConsentAtCookiePolicyUpdate\": \"true\",\n    \"enableFadp\": \"true\",\n    \"enableLgpd\": \"true\",\n    \"lgpdAppliesGlobally\": \"true\",\n    \"enableUspr\": \"true\",\n    \"enableCcpa\": \"true\",\n    \"ccpaAcknowledgeOnDisplay\": \"true\",\n    \"ccpaApplies\": \"true\",\n    \"consentOnContinuedBrowsing\": \"false\",\n    \"floatingPreferencesButtonDisplay\": \"bottom-left\",\n    \"invalidateConsentWithoutLog\": \"true\",\n    \"perPurposeConsent\": \"true\",\n    \"whitelabel\": \"false\",\n    \"banner\": {\n        \"acceptButtonDisplay\": \"true\",\n        \"backgroundOverlay\": \"true\",\n        \"closeButtonRejects\": \"true\",\n        \"customizeButtonDisplay\": \"true\",\n        \"explicitWithdrawal\": \"true\",\n        \"fontSize\": \"14px\",\n        \"listPurposes\": \"true\",\n        \"position\": \"float-center\",\n        \"rejectButtonDisplay\": \"true\",\n        \"showPurposesToggles\": \"true\",\n    },\n}\n```\n\n### Integration with Google Tag Manager\nIf Google Tag Manager is implemented in your application and all needed settings were configured inside the container,\nthe variable `IUBENDA_GTM` can be set with the value `True` and the Iubenda's callback will be inserted inside the script.\n\nFor needed configuration inside Google Tag Manager container, please refer to these notes:\n- [Google Consent Mode](https://www.iubenda.com/en/help/27137-google-consent-mode)\n- [Google Consent Mode setup GTM with Iubenda](https://www.iubenda.com/en/help/74198-google-consent-mode-set-up-google-tag-manager-with-iubenda)\n- [GTM Blocking Cookies](https://www.iubenda.com/en/help/1235-google-tag-manager-blocking-cookies)\n\n## Run Example Project\n\n```shell\ngit clone --depth=50 --branch=django-iubenda https://github.com/DLRSP/example.git DLRSP/example\ncd DLRSP/example\npython manage.py runserver\n```\n\nNow browser the app @ http://127.0.0.1:8000\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlrsp%2Fdjango-iubenda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlrsp%2Fdjango-iubenda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlrsp%2Fdjango-iubenda/lists"}