Document CSP nonce requirements for Django Debug Toolbar compatibility

Author: robhudsonCreated Jan 16, 2025Updated Aug 28, 2026
LabelsDocumentationDjangonaut Space :rocket:

In a comment it was pointed out that users with django-csp enabled may need some extra set up to allow the debug toolbar to function correctly. Since these users will get the nonce applied to the toolbar's <script> tags.

Perhaps some documentation along these lines should be included in the documentation...


Debug Toolbar and CSP Nonces

When using django-csp, the toolbar's inline <script> tags will include CSP nonces. To ensure the debug toolbar functions correctly during development, make sure the nonce is included in your script-src directive in the Content-Security-Policy header.

Source: django-commons/django-debug-toolbar