Search code examples
pythondjangockeditordjango-ckeditor

Django-CKEditor won't render images


I've installed Django-CKEditor and configurated it for development purposes.

Now I can edit text and save it to db as text field. But with inserting images I have major problems...

I can insert image and it seems to save properly to local host (to correct folder) but when rendering image to preview or text editor I get only broken image picture. Apparently I haven't configured settings.py correctly. Main items from settings.py:

MEDIA_ROOT = ''
MEDIA_URL = '/media/'
STATIC_ROOT = ''
STATIC_URL = '/static/'
CKEDITOR_UPLOAD_PATH = 'media/uploads/'
CKEDITOR_UPLOAD_PREFIX = 'media/uploads/'

Also tried similar configuration than django-ckeditor testproject has but faced similar broken rendering images.

I'm using windows environment for development. Django-ckeditor version is 4.0.2

Any ideas what is wrong or where to start solving this?


Solution

  • Found the root cause.

    After debugging it found out that django-ckeditor has problems with Windows back-slashes. First I made my own correction but finally also found out that this has been already reported and correction proposal also made but not yet merged to master branch:

    Fixing trouble with backward slashes in Windows