Name | django-iubenda JSON |
Version |
1.6.4
JSON |
| download |
home_page | https://github.com/DLRSP/django-iubenda |
Summary | Django''s application for handling privacy and cookie policies configured with Iubenda. |
upload_time | 2024-04-27 22:31:54 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2010-present DLRSP (https://dlrsp.org) and other contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
django
iubenda
privacy
cookie
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# django-iubenda [![PyPi license](https://img.shields.io/pypi/l/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)
[![PyPi status](https://img.shields.io/pypi/status/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)
[![PyPi version](https://img.shields.io/pypi/v/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)
[![PyPi python version](https://img.shields.io/pypi/pyversions/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)
[![PyPi downloads](https://img.shields.io/pypi/dm/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)
[![PyPi downloads](https://img.shields.io/pypi/dw/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)
[![PyPi downloads](https://img.shields.io/pypi/dd/django-iubenda.svg)](https://pypi.python.org/pypi/django-iubenda)
## 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)
## 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)
## Compliance for websites and apps
Click [here](http://iubenda.refr.cc/dlrspapi) and get 10% discount on first year at Iubenda
[![Iubenda](https://client-assets.referralcandy.com/md6Y46jBT5ufTCO2zzGt_1668598186.png)](http://iubenda.refr.cc/dlrspapi)
## Check Demo Project
* Check the demo repo on [GitHub](https://github.com/DLRSP/example/tree/django-iubenda)
## Requirements
- Python +3.8 supported.
- Django +3.2 supported.
## Setup
1. Install from **pip**:
```shell
pip install django-iubenda
```
2. Modify `settings.py` by adding the app to `INSTALLED_APPS`:
```python
INSTALLED_APPS = (
"modeltranslation",
# ...
"iubenda",
# ...
)
```
3. Modify `settings.py` by adding the app's context processor to `TEMPLATES`:
```python
TEMPLATES = [
{
# ...
"OPTIONS": {
"context_processors": [
# ...
"iubenda.context_processors.iubenda",
# ...
],
},
},
]
```
4. Be sure the Django's Locale middleware is enabled inside `settings.py`:
```python
MIDDLEWARE = (
# ...
"django.middleware.locale.LocaleMiddleware",
# ...
)
```
5. Optionally, but sugguested, the Django's Current Site middleware is enabled inside `settings.py`:
```python
MIDDLEWARE = (
# ...
"django.contrib.sites.middleware.CurrentSiteMiddleware",
# ...
)
```
6. Modify `url.py` by adding the app's urls to `urlpatterns`:
```python
urlpatterns += [
path("", include("iubenda.urls")),
]
```
7. Modify `url.py` by adding the app's sitemaps to `sitemaps`:
```python
from iubenda.sitemaps import PrivacySitemap, CookieSitemap
sitemaps = {
# ...
"privacy": PrivacySitemap,
"cookie": CookieSitemap,
# ...
}
```
8. Be sure the variable `LANGUAGE_CODE` is available for HTML templates:
```html
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
```
9. Modify your project's template to add privacy and cookie policies.
For example inside the `footer.html` add following code:
```html
{% if not debug %}
{% block iubenda %}{% include "iubenda/include-content.html" %}{% endblock iubenda %}
{% endif %}
```
## Optional
### Autoblocking
If Iubenda autoblocking's configurations are implemented in your account,
the variable `IUBENDA_AUTOBLOCKING` can be set to import the site's script.
```html
<script src="https://cs.iubenda.com/autoblocking/{{ cx_iubenda.iub_site_id }}.js"></script>
```
### Content Security Policy
If Content Security Policy are implemented in your server and inline scripts are disabled,
the variable `IUBENDA_CSP_NONCE` can be set with nonce tag will be inserted script's nonce.
```html
<script {% if cx_iubenda_nonce %}nonce="{{ cx_iubenda_nonce }}"{% endif %}>
```
Inside your webserver's configurations, a rule to dynamically replace your CONSTANT nonce in a random string is needed.
To allow external source from Iubenda domains, please implement these rules:
```editorconfig
Content-Security-Policy:
script-src-elem https://*.iubenda.com";
img-src https://*.iubenda.com data:";
style-src https://*.iubenda.com";
connect-src https://*.iubenda.com";
frame-src https://*.iubenda.com";
```
If you prefer to not allow ***unsafe-inline*** inside your CSP, please also add the two specific hash for your
script prompted as error in Javascript Console.
```editorconfig
# Iubenda Privacy And Cookie Policy - API
Content-Security-Policy:
...
script-src-elem https://*.iubenda.com 'sha256-YOUR-FIRST-HASH-PROMPTED-INSIDE-CONSOLE' 'sha256-YOUR-SECOND-HASH-PROMPTED-INSIDE-CONSOLE';
...
```
Check 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)
### Iubenda's Options
To personalize the Iubenda script's behaviour, the dict `IUBENDA_OPTIONS` can be configured inside `settings.py`
```python
IUBENDA_OPTIONS = {
"countryDetection": "true",
"askConsentAtCookiePolicyUpdate": "true",
"enableFadp": "true",
"enableLgpd": "true",
"lgpdAppliesGlobally": "true",
"enableUspr": "true",
"enableCcpa": "true",
"ccpaAcknowledgeOnDisplay": "true",
"ccpaApplies": "true",
"consentOnContinuedBrowsing": "false",
"floatingPreferencesButtonDisplay": "bottom-left",
"invalidateConsentWithoutLog": "true",
"perPurposeConsent": "true",
"whitelabel": "false",
"banner": {
"acceptButtonDisplay": "true",
"backgroundOverlay": "true",
"closeButtonRejects": "true",
"customizeButtonDisplay": "true",
"explicitWithdrawal": "true",
"fontSize": "14px",
"listPurposes": "true",
"position": "float-center",
"rejectButtonDisplay": "true",
"showPurposesToggles": "true",
},
}
```
### Integration with Google Tag Manager
If Google Tag Manager is implemented in your application and all needed settings were configured inside the container,
the variable `IUBENDA_GTM` can be set with the value `True` and the Iubenda's callback will be inserted inside the script.
For needed configuration inside Google Tag Manager container, please refer to these notes:
- [Google Consent Mode](https://www.iubenda.com/en/help/27137-google-consent-mode)
- [Google Consent Mode setup GTM with Iubenda](https://www.iubenda.com/en/help/74198-google-consent-mode-set-up-google-tag-manager-with-iubenda)
- [GTM Blocking Cookies](https://www.iubenda.com/en/help/1235-google-tag-manager-blocking-cookies)
## Run Example Project
```shell
git clone --depth=50 --branch=django-iubenda https://github.com/DLRSP/example.git DLRSP/example
cd DLRSP/example
python manage.py runserver
```
Now browser the app @ http://127.0.0.1:8000
Raw data
{
"_id": null,
"home_page": "https://github.com/DLRSP/django-iubenda",
"name": "django-iubenda",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "django, iubenda, privacy, cookie",
"author": null,
"author_email": "DLRSP <dlrsp.dev@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d6/28/7ee783333a4daaeaee5ffa4fbcc9b43035da7dfa4c1c8062c801cf37937c/django_iubenda-1.6.4.tar.gz",
"platform": null,
"description": "# 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<script src=\"https://cs.iubenda.com/autoblocking/{{ cx_iubenda.iub_site_id }}.js\"></script>\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<script {% if cx_iubenda_nonce %}nonce=\"{{ cx_iubenda_nonce }}\"{% endif %}>\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",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2010-present DLRSP (https://dlrsp.org) and other contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Django''s application for handling privacy and cookie policies configured with Iubenda.",
"version": "1.6.4",
"project_urls": {
"Homepage": "https://github.com/DLRSP/django-iubenda"
},
"split_keywords": [
"django",
" iubenda",
" privacy",
" cookie"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d6287ee783333a4daaeaee5ffa4fbcc9b43035da7dfa4c1c8062c801cf37937c",
"md5": "9a788d50bd6d0c3feb51528cd778b9d0",
"sha256": "c0f746aacbbe4812073deac67221989ffab35482dbfde77b6b637e541b6283ca"
},
"downloads": -1,
"filename": "django_iubenda-1.6.4.tar.gz",
"has_sig": false,
"md5_digest": "9a788d50bd6d0c3feb51528cd778b9d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 45919,
"upload_time": "2024-04-27T22:31:54",
"upload_time_iso_8601": "2024-04-27T22:31:54.678955Z",
"url": "https://files.pythonhosted.org/packages/d6/28/7ee783333a4daaeaee5ffa4fbcc9b43035da7dfa4c1c8062c801cf37937c/django_iubenda-1.6.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-27 22:31:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DLRSP",
"github_project": "django-iubenda",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-iubenda"
}