Django ckeditor上传图片

Django ckeditor upload image

我正在尝试使用 ckeditor 上传图片。看起来一切都是由文档设置的,但我在尝试上传图像时仍然遇到错误。我认为静态文件有问题。看起来 ckeditor 不知道在哪里上传文件,即使我已经提供了所有需要的参数:

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

CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_IMAGE_BACKEND = 'pillow'

我收到这条消息:

[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".

我的项目中的 'static' 文件夹位置似乎有问题。我已经解决了添加

的问题
CKEDITOR_STORAGE_BACKEND = 'django.core.files.storage.FileSystemStorage'

到我的设置文件。不确定它是否适合你,但它肯定适合我,因为 'FileSystemStorage' 默认寻找 'MEDIA_ROOT' 设置。