Sharath Nayak
Sharath Nayak

Reputation: 217

How to add CSP for Django CKEditor

I'm not using CDN or any link for CKEditor but I have PIP installed it using pip install django-ckeditor. I have added all necessary CSPs and CKEditor configurations in settings.py file but CKEditor is not working in html. Please help me fix it.

Upvotes: 0

Views: 553

Answers (2)

Alexander Astashov
Alexander Astashov

Reputation: 176

  1. You can add 'unsafe-inline' to style-src and it will work for you. But it does not look safe
  2. You can add all the hash that your browser shows you and set up CSP reports in Sentry to keep track of changes
  3. You can stop using CSP for this page
  4. We can stop using CKEditor since it has all inline styles

I will choose option 2 and will consider option number 4 in the future.

Help links

Upvotes: 1

Medard Dziedzic
Medard Dziedzic

Reputation: 11

Try <p> {{form.media}} {{form.as_p}} </p> <p> {{form.media}} {{form.as_p|safe}} </p>

Upvotes: 0

Related Questions