python - Django ckeditor上传图片

标签 python django ckeditor django-ckeditor

我正在尝试使用 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".

最佳答案

我的项目中的“静态”文件夹位置似乎存在问题。我已经解决了添加的问题

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

到我的设置文件。不确定它是否适合您,但它绝对适合我,因为“FileSystemStorage”默认查找“MEDIA_ROOT”设置。

关于python - Django ckeditor上传图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60364871/

相关文章:

ckeditor - 如何配置CKEditor-4内联编辑器?

Python 3.6 : Feedparser issue getting sub-attributes

python - 无法为 Python 2.7 获取 SFML

Python 包路径::查找应该是 .py 文件的目录

python - default_storage.exists 极其缓慢且经常超时

javascript - CKEditor 转换输入源

python - 在 Python 中使用 Objective C 函数调用样式

python - 如何将列表中的元素拆分为两个元素?

python - 亚马逊网络服务 (AWS) 上的 Django

javascript - 将 CkEditor 中的文本保存到本地磁盘上