pip install django-ckeditor
添加到
INSTALLED_APPS
,正在添加上载路径:
CKEDITOR_UPLOAD_PATH = "ckeditor_uploads/"
运行
manage.py collecstatic
只添加了两个文件,并将URL添加到
url.py
url(r'^ckeditor/', include('ckeditor_uploader.urls')),
我不能百分之百确定我是否遗漏了什么。
class BlogPost(models.Model):
title = models.CharField(max_length=255, blank=False, null=False)
body = RichTextField(blank=False, null=False)
当我试图在管理工具上添加新记录时,会出现以下错误:
ckeditor/widget.html
模板加载程序死后如下所示:
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.filesystem.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\django\forms\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\core\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\django\contrib\admin\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\django\contrib\auth\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\rest_framework\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\reversion\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\colorfield\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\ckeditor_uploader\templates\ckeditor\widget.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\pupeno\projectx\venv\lib\site-packages\django_extensions\templates\ckeditor\widget.html (Source does not exist)
ckeditor/widget.html
从
ckeditor_uploader
但是
widget.html
ckeditor
,不是
:
你知道这是怎么回事吗?
我还试着把这块地变成
RichTextUploadingField
,但我也有同样的错误。