首页 > Web开发 > 详细

xadmin 集成ckeditor并解决上传视频问题

时间:2021-04-12 22:52:41      阅读:47      评论:0      收藏:0      [点我收藏+]

安装

pip install django-ckeditor

settings.py

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
    }
}

urls.py

path(‘editor/‘, include(‘ckeditor_uploader.urls‘)),

models.py

from ckeditor_uploader.fields import RichTextUploadingField

class Nodes(models.Model):
    content = RichTextUploadingField(null=True, blank=True, verbose_name=‘详情‘)

同步数据库之后,就可以了。

解决问题:没有上传视频的功能

点击下载 html5video

  1. 解压后的文件夹放到python \site-packages\ckeditor\static\ckeditor\ckeditor\plugins 目录下。

  2. 修改\site-packages\ckeditor\static\ckeditor\config.js

    CKEDITOR.editorConfig = function( config ) {
        config.language = ‘zh-cn‘,
        config.extraPlugins = ‘html5video‘;
    };
    

xadmin 集成ckeditor并解决上传视频问题

原文:https://www.cnblogs.com/huangxm/p/14649374.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!