2

I am experiencing this strange error only on my production environment. It works fine locally and on staging.

I'm using Django==1.10.5 & django-blog-zinnia==0.18.1 with zinnia-wysiwyg-ckeditor==1.3. I believe this issue happened recently when we upgraded from Django==1.8 to the latest.

When I try to create a blog entry, I can't edit the content because the ckeditor instance does not load. The errors are:

https://example.com/admin/zinnia/entry/81/change/config.js/change/ 404 (Not Found) https://example.com/admin/zinnia/entry/81/change/lang/en.js/change/ GET https://example.com/admin/zinnia/entry/81/change/skins/moono-lisa/editor.css/change/ Uncaught TypeError: Cannot set property 'dir' of undefined

The URL is /admin/zinnia/entry/81/change/

So this very much looks like ckeditor.js is trying to load additional static files based on the current URLs and somehow it injects the filenames into the current URL.

As a workaround, I ssh-ed into the server and manipulated /static/ckeditor/ckeditor/ckeditor.8bd276b5ef4c.js and added this line at the very top:

window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';

This solves the issue. The big question is: Why does this only happen on one of my machines, why does Django/zinnia not set CKEDITOR_BASEPATH correctly by itself?

I'm posting this here because I am not sure if this is an issue in Django, zinnia or zinnia-ckeditor, if anyone got insights on who is guilty, I'm happy to re-post this issue on the relevant issue tracker on github.

EDIT:

As a workaround, in my project I created the file templates/admin/change_form.html:

{% extends "admin/change_form.html" %}

{% block extrahead %}

<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>

{{ block.super }}

{% endblock %}

mbrochh
  • 1,011
  • 1
  • 10
  • 21

0 Answers0