PythonAnywhere Forums

CKeditor Install Guide

Rich Text Field CKeditor Install

You will want your text typed in the admin section to remain formatted. By default django will just turn it all into a long string of plain text.

You should use an additional WYSIWYG module - ckeditor

PythonAnywhere Install:

Open a bash console and type pip3.6 install --user django-ckeditor

Note that you literally type “--user” not your username! Also, the pip3.6 depends on the version of python you are using.

Check the python version of your virtual environment first (not the top level bash script)

workon django18
python --version

Or go into the virtual environment by using workon django18 (or whatever you called it) and then pip install django-ckeditor

In your top-level file:

STATIC_URL = '/static/'
MEDIA_URL = '/media/'

    'default': {
        'toolbar': 'Advanced',
        'width': 758,
        'height': 300,

Next, go to the top-level

urlpatterns = [
    url(r'^ckeditor/', include(''ckeditor_uploader.urls')),

Now go into your app and open it’s file so username/app/

from django.db import models
from ckeditor.fields import RichTextField

class Project(models.Model):
    project_code = RichTextField(verbose_name='Code',null=True,blank=True)

Making all those changes, especially adding in a new installed app, means you have to update the database. And do a static collection.

python collectstatic
python makemigrations <your-app-name>
python migrate

Finally, when using variable names in the html templates by default Django will not read the html tags generated by CKeditor. Instead it will print them. So you will see <p>my sentence</p>

To fix that make the variable names “safe”


hi andycv, thanks for giving us a nice guide for installing CKeditor!