Settings
The cookie settings (name, max-age, domain…) follow the same principles like Django’s built-in session cookie. For more details, please check that documenation for more details about the meaning.
COOKIE_CONSENT_NAMEname of consent cookie that remembers user choice
Default:
cookie_consent.COOKIE_CONSENT_MAX_AGEmax-age of consent cookie, in seconds
Default: 1 year
COOKIE_CONSENT_DOMAINDomain to restrict the cookie to.
Default:
NoneCOOKIE_CONSENT_SECUREWhether to only set the cookie in an HTTPS context.
Default:
FalseCOOKIE_CONSENT_HTTPONLYWhether access from Javascript is blocked.
Default:
TrueCOOKIE_CONSENT_SAMESITEThe SameSite policy. Possible values are
"Strict","Lax","None"orFalseto disable setting the flag.Default:
"Lax"COOKIE_CONSENT_DECLINEdecline value
Default:
-1COOKIE_CONSENT_ENABLEDboolean or callable that receives request and returns a boolean.
For example, if you want to enable cookie consent for debug or staff only:
COOKIE_CONSENT_ENABLED = lambda r: DEBUG or (r.user.is_authenticated and r.user.is_staff)
Default:
TrueCOOKIE_CONSENT_OPT_OUTBoolean value represents if cookies are opt-in (
False) or opt-out (True). Opt-out cookies are set until declined. Opt-in cookies are set only if accepted.Default:
FalseCOOKIE_CONSENT_CACHE_BACKENDAlias for backend to use for caching.
Default:
defaultCOOKIE_CONSENT_LOG_ENABLEDBoolean value represents if the accept/decline user actions will be logged to the database. Turning it off might be useful for preventing your database from getting filled up with log items.
Default:
TrueCOOKIE_CONSENT_SUCCESS_URLThe success URL to redirect the user to after a successful accept/decline action. If a
?nextparameter is present in the request, then it takes priority over this setting.Default: the URL of the built-in cookie list view.