Django: Installing Django Ckeditor, Ckeditor is awesome editor and most popular editor was used for website, and compatible with django.
1. Install or add django-ckeditor to your python path.
$ pip install django-ckeditor
ckeditor_uploader to your
3. django-ckeditor uses jQuery in ckeditor-init.js file. You must set
CKEDITOR_JQUERY_URL to a jQuery URL that will be used to load the library. If you have jQuery loaded from a different source just don’t set [CKEDITOR_JQUERY_URL] and django-ckeditor will not try to load its own jQuery. If you find that CKEditor widgets don’t appear in your Django admin site then check that this variable is set correctly. Example:
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
4. Run the collectstatic management command:
$ ./manage.py collectstatic. This will copy static CKEditor required media resources into the directory given by the
STATIC_ROOT setting. See Django’s documentation on managing static files for more info.
For more installation you can checkout on this repository: https://github.com/django-ckeditor/django-ckeditor#installation
And in this post we want to show you how to setting
`Choose File` for your image like this picture:
Default setting from ckeditor uses
RichTextField, so like what was notice says: “Django admin CKEditor integration. Provides a
RichTextField, RichTextUploadingField, CKEditorWidget and
CKEditorUploadingWidget utilizing CKEditor with image upload and browsing support included.”
in your models.py change
from ckeditor_uploader.fields import RichTextUploadingField class Entry(models.Model): title = models.CharField(max_length=200) slug = models.SlugField(max_length=200, unique=True) images = models.ImageField(upload_to='blog/images/%Y/%m/%d', blank=True) tags = models.ManyToManyField('Tag') body = RichTextUploadingField() #RichTextField()
Helpfull can help.
Thanks for Lukman Namkul for solved this problem.
posted 1 year, 10 months ago