Professional Documents
Culture Documents
code
source
Open the settings.py file and add the coding snippet in INSTALLED_APPS
code
source
1. 'ckeditor',
2.
3. 'ckeditor_uploader',
4.
code
source
1. CKEDITOR_UPLOAD_PATH = 'uploads/'
2.
code
source
1. STATIC_URL = '/static/'
2.
3. STATIC_ROOT = os.path.join(BASE_DIR, "static")
4.
5. MEDIA_URL = '/media/'
6.
7. MEDIA_ROOT = os.path.join(BASE_DIR, "media")
8.
code
source
code
source
1. path('ckeditor/', include('ckeditor_uploader.urls')),
2.
Now start an app and goto it's models.py file. Now we are going to create a model name article
with title and body. Title will be the charfield but body will be editor. Follow the code below
code
source
Now migrate the model and visite the add article page and you will see like following.
You can't upload any image, rather you only add the link to show image here. Just re-write the
code to upload image and add Rich
code
source
You have to add a simple change in form.html file for upload image. Add the following coding
snippet after {% csrf_token %}
code
source
1. {{ form.media }}
2.