Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在Django中安装CKEditor插件_Python_Django_Ckeditor_Django Ckeditor - Fatal编程技术网

Python 如何在Django中安装CKEditor插件

Python 如何在Django中安装CKEditor插件,python,django,ckeditor,django-ckeditor,Python,Django,Ckeditor,Django Ckeditor,我正在尝试为django CKEditor安装一个图像上传插件。但是,这些按钮不会出现在CKeditor小部件中 我安装CKEditor插件的步骤如下: 下载并提取图像上传程序和CKEditor插件浏览器 将提取的文件复制到CKeditor的静态文件夹,即/project/static/CKeditor/CKeditor/plugins/imageuploader。还尝试使用manage.py collectstatic 如下所示配置settings.py文件 CKEDITOR_CONFIGS

我正在尝试为django CKEditor安装一个图像上传插件。但是,这些按钮不会出现在CKeditor小部件中

我安装CKEditor插件的步骤如下:

  • 下载并提取图像上传程序和CKEditor插件浏览器
  • 将提取的文件复制到CKeditor的静态文件夹,即/project/static/CKeditor/CKeditor/plugins/imageuploader。还尝试使用manage.py collectstatic
  • 如下所示配置settings.py文件

    CKEDITOR_CONFIGS = {
        'default': {
            'toolbar': [
                [      'Undo', 'Redo',
                  '-', 'Bold', 'Italic', 'Underline',
                  '-', 'Link', 'Unlink', 'Anchor',
                  '-', 'Format',
                  '-', 'SpellChecker', 'Scayt',
                  '-', 'Maximize',
                ],
            ],
            'width': 840,
            'height': 300,
            'toolbarCanCollapse': False,
        },
    
        'simple_toolbar': {
            'toolbar': [['imageuploader',],],
            'width': 840,
            'height': 300,
            'removePlugins': 'stylesheetparser',
            'extraPlugins': 'imageuploader',
        },
    
    }
    
    class Form(forms.ModelForm):
        description=forms.CharField(widget=CKEditorWidget(config_name='simple_toolbar'
    ))
    
  • 如下所示配置小部件

    CKEDITOR_CONFIGS = {
        'default': {
            'toolbar': [
                [      'Undo', 'Redo',
                  '-', 'Bold', 'Italic', 'Underline',
                  '-', 'Link', 'Unlink', 'Anchor',
                  '-', 'Format',
                  '-', 'SpellChecker', 'Scayt',
                  '-', 'Maximize',
                ],
            ],
            'width': 840,
            'height': 300,
            'toolbarCanCollapse': False,
        },
    
        'simple_toolbar': {
            'toolbar': [['imageuploader',],],
            'width': 840,
            'height': 300,
            'removePlugins': 'stylesheetparser',
            'extraPlugins': 'imageuploader',
        },
    
    }
    
    class Form(forms.ModelForm):
        description=forms.CharField(widget=CKEditorWidget(config_name='simple_toolbar'
    ))
    
  • 试试这个:

    在您的模型中:

    class YouModel(models.Model)
        text = HTMLField(configuration='CKEDITOR_SETTINGS_MODEL1', blank=True)
    
    在settings.py文件中:

    CKEDITOR_SETTINGS_MODEL1 = {
        'language': '{{ language }}',
        'toolbar_HTMLField': [
        {'name': 'basicstyles', 'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
            {'name': 'colors', 'items': ['TextColor', 'BGColor']},
            {'name': 'paragraph', 'items': ['NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote', 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
                        'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language']},
            {'name': 'clipboard', 'items': ['Paste', 'Undo', 'Redo']},
            {'name': 'tools', 'items': ['Maximize']},
            {'name': 'styles', 'items': ['Styles', 'Format', 'Font', 'FontSize', 'Scayt']},
            {'name': 'document', 'items': ['Preview', 'Print']},
            {'name': 'editing', 'items': ['Find', 'Replace', 'SelectAll']},
            {'name': 'links', 'items': ['Link', 'Unlink', 'Table', 'SpecialChar', 'Smiley']},
        ],
        'height': '777px',
        'width': '759px',
        'scayat_slang': ['en_US, en_GB, pt_BR, da_DK, nl_NL, en_CA, fi_FI, fr_FR, fr_CA, de_DE, el_GR, it_IT, nb_NO, pt_PT, es_ES, uk_UK'],
        'removePlugins': 'elementspath',
        'extraPlugins': ','.join(['div', 'clipboard', 'dialog', 'scayt',]), 
    }
    
    您可以更改此大小、按钮和其他

    尝试以下操作:

    在您的模型中:

    class YouModel(models.Model)
        text = HTMLField(configuration='CKEDITOR_SETTINGS_MODEL1', blank=True)
    
    在settings.py文件中:

    CKEDITOR_SETTINGS_MODEL1 = {
        'language': '{{ language }}',
        'toolbar_HTMLField': [
        {'name': 'basicstyles', 'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
            {'name': 'colors', 'items': ['TextColor', 'BGColor']},
            {'name': 'paragraph', 'items': ['NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote', 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
                        'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language']},
            {'name': 'clipboard', 'items': ['Paste', 'Undo', 'Redo']},
            {'name': 'tools', 'items': ['Maximize']},
            {'name': 'styles', 'items': ['Styles', 'Format', 'Font', 'FontSize', 'Scayt']},
            {'name': 'document', 'items': ['Preview', 'Print']},
            {'name': 'editing', 'items': ['Find', 'Replace', 'SelectAll']},
            {'name': 'links', 'items': ['Link', 'Unlink', 'Table', 'SpecialChar', 'Smiley']},
        ],
        'height': '777px',
        'width': '759px',
        'scayat_slang': ['en_US, en_GB, pt_BR, da_DK, nl_NL, en_CA, fi_FI, fr_FR, fr_CA, de_DE, el_GR, it_IT, nb_NO, pt_PT, es_ES, uk_UK'],
        'removePlugins': 'elementspath',
        'extraPlugins': ','.join(['div', 'clipboard', 'dialog', 'scayt',]), 
    }
    

    您可以更改此大小、按钮和其他

    如果您有图像上传器插件只需添加到工具栏如果您有图像上传器插件只需添加到工具栏