zavullon
zavullon

Reputation: 53

Django ckeditor upload image

I'm trying to use ckeditor to upload an image. Looks like everything is set up by documentation, but still I'm getting an error while trying to upload an image. I think that there is a problem with static files. Looks like ckeditor doesn't know where to upload files, even though I've provided all needed parameters:

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_IMAGE_BACKEND = 'pillow'

I'm getting this message:

[23/Feb/2020 20:17:47] "POST /ckeditor/upload/&responseType=json HTTP/1.1" 302 0

And here's what I get in browser. The red one is for "incorrect server response".

Upvotes: 1

Views: 907

Answers (1)

zavullon
zavullon

Reputation: 53

Looks like there is a problem with 'static' folder location in my project. I've solved my problem adding

CKEDITOR_STORAGE_BACKEND = 'django.core.files.storage.FileSystemStorage'

To my settings file. Not sure if it will work for you, but it definitely works for me since 'FileSystemStorage' looks for 'MEDIA_ROOT' setting by default.

Upvotes: 1

Related Questions