djangodjango-templatesckeditorckeditor4.xdjango-ckeditor

ckeditor Youtube plugin.js returns 404 error on not display when extraPlugins add?


youtube plugin installed location is /static/ckeditor/ckeditor/plugins/youtube/youtube/ i get this error when i run that configurations 'extraPlugins': ','.join(['youtube']), if returns "GET /static/ckeditor/ckeditor/plugins/youtube/plugin.js?t=JB9C HTTP/1.1" 404 1863 error and ckeditor is not display models.py

from ckeditor_uploader.fields import RichTextUploadingField
from django.db import models


class Article(models.Model):
     title = models.CharField(max_length=100)
     content = RichTextUploadingField(blank=True)

    def __str__(self):
        return self.title

settings.py

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'assets'),
)

CKEDITOR_UPLOAD_PATH = 'article/'
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_CONFIGS = {
    'default': {
        'width': 'auto',
        'extraPlugins': ','.join(['youtube']), # return "GET /static/ckeditor/ckeditor/plugins/youtube/plugin.js?t=JB9C HTTP/1.1" 404 1863 error and ckeditor is not display
        'toolbar': [
            ['Bold', 'Italic', 'Underline'],
            ['Font', 'FontSize', 'TextColor', 'BGColor'],
            ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-',
                'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
            ['Link', 'Unlink'],
            ['RemoveFormat', 'Source', 'Image', 'Youtube']
        ],
    }
}

config.js

CKEDITOR.editorConfig = function (config) {

    config.extraPlugins = 'youtube';
};


Solution

  • Your relative path for the plugin must be: /static/ckeditor/ckeditor/plugins/youtube/

    And what you are using is /static/ckeditor/ckeditor/plugins/youtube/youtube/

    Remove that extra "youtube" directory,rest of the code is fine.