我正在使用django-ckeditor 5.8.0
with python3.6
, django 2.2.5
onubuntu 18.04.3
settings.py
CKEDITOR_CONFIGS = {
'default': {
'skin': 'moono',
'width': '100%',
'toolbar_Basic': [
['Source', '-', 'Bold', 'Italic']
],
{'name': 'paragraph',
'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-',
'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl',
'Language']},
{'name': 'links', 'items': ['Link', 'Unlink', 'Anchor']},
{'name': 'insert',
'items': ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']},
'/',
{'name': 'styles', 'items': [
'Styles', 'Format', 'Font', 'FontSize']},
'/',
{'name': 'yourcustomtools', 'items': [
'CodeSnippet',
]},
],
'toolbar': 'YourCustomToolbarConfig',
'tabSpaces': 4,
'extraPlugins': ','.join([
'uploadimage',
'codesnippet',
]),
}
}
models
:
content = RichTextUploadingField()
CKEditor 的static
文件以admin
mode 提供,但css
file( contents.css
) 不会在其他views
地方加载。
我正在使用ManifestStaticFilesStorage
并且在运行之后collectstatic
,文件存在于它应该存在的地方。
我还在以下行中添加了template
:
<script>window.CKEDITOR_BASEPATH = "{% static '/ckeditor/ckeditor/' %}";</script>
<script type="text/javascript" src="{% static 'ckeditor/ckeditor-init.js' %}" data-ckeditor-basepath="{% static 'ckeditor/ckeditor/' %}" id="ckeditor-init-script"></script>
<script type="text/javascript" src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>
***
{{content|safe}}
这是html
来自浏览器的图像:
单击这两个js
文件也会显示其内容,这意味着它们是可访问的。
contents.css
文件未加载,因此没有样式。
同样的故事development
server
。
任何解决问题的建议都会很棒。