当我想在CKEditor中上载图像时,它会显示错误“文件上载期间发生HTTP错误(错误状态:400)”
请检查下面的图片
内部URL.py
from django.contrib import admin
from django.urls import path,include
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
urlpatterns = i18n_patterns(
....
path('ckeditor/',include('ckeditor_uploader.urls')),
....
)
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
内部设置.py--->;对于CKEDITOR
INSTALLED_APPS = [
...,
'ckeditor',
'ckeditor_uploader',
...,
]
#Ckeditor
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_UPLOAD_PATH="uploads/"
CKEDITOR_CONFIGS={
'myconfig':{
'toolbar':"Custom",
'toolbar_Custom':[
['Styles','Format','Font','FontSize','BidiLtr','BidiRtl'],
['JustifyLeft','JustifyCenter','JustifyRight','NumberedList', 'BulletedList','Bold','Italic','Underline','Strike','Undo','Redo'],
['Link','Unlink','Anchor'],
['TextColor','BGColor'],
['Smilely','SpecialChar'],
['Source','Scayt','Maximize'],
['Table','Templates','Iframe','Image'],
],
'height': 100,
},
}
在models.py中
content = RichTextUploadingField(config_name='myconfig')
你能帮我吗
若要上载图像,请尝试以下操作
在设置中:
在主URL中:
在你的模型中.py
应该这样做
相关问题 更多 >
编程相关推荐