pip install django-ckeditor
INSTALLED_APPS = [
...
‘ckeditor‘,
‘ckeditor_uploader‘,
]
CKEDITOR_UPLOAD_PATH = ‘editor‘
CKEDITOR_IMAGE_BACKEND = ‘pillow‘
CKEDITOR_FILENAME_GENERATOR = ‘utils.upload_path.create_filename‘
CKEDITOR_CONFIGS = {
‘default‘: {
‘toolbar‘: ‘full‘,
‘height‘: 300,
‘width‘: 900
}
}
path(‘editor/‘, include(‘ckeditor_uploader.urls‘)),
from ckeditor_uploader.fields import RichTextUploadingField
class Nodes(models.Model):
content = RichTextUploadingField(null=True, blank=True, verbose_name=‘详情‘)
同步数据库之后,就可以了。
点击下载 html5video
解压后的文件夹放到python \site-packages\ckeditor\static\ckeditor\ckeditor\plugins 目录下。
修改\site-packages\ckeditor\static\ckeditor\config.js
CKEDITOR.editorConfig = function( config ) {
config.language = ‘zh-cn‘,
config.extraPlugins = ‘html5video‘;
};
原文:https://www.cnblogs.com/huangxm/p/14649374.html