I have (tried to) set up django-tinymce in my Django project. However, in the inspector, I don’t see the tinymce.min.js being loaded.
This is in my settings:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = 'localhost:8123'
# TinyMCE configuration
TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, "articles/build/lib/node_modules/tinymce")
TINYMCE_JS_URL = os.path.join(TINYMCE_JS_ROOT, "tinymce.min.js")
TINYMCE_COMPRESSOR = False
TINYMCE_DEFAULT_CONFIG = {
'theme': "modern",
'toolbar': "undo redo | bold italic | bullist numlist | blockquote | removeformat",
'menubar': False,
'statusbar': False,
'schema': "html5",
'max_height': 500,
'max_width': 500,
'min_height': 100,
'min_width': 400
}
Removing the TINYMCE_DEFAULT_CONFIG
and changing tinymce.min.js
into tinymce.js
does not change anything—still no tinymce js being loaded.
This is my file structure:
static
|-src
| |-styles
| |-scripts
| |-images
|-build
| |-css
| |-js
| |-img
| |-lib
| | |-package.json
| | |-node_modules
| | | |-tinymce
| | | | |-tinymce.js
| | | | |-more_tinymce_files_here
|-node_modules
|-gulpfile.js
|-package.json
In my template I do have {{ form.media }}
, but maybe that‘s the problem.
The full code with templates, settings, urls, etc. is available here.
How can I make sure that the tinymce javascript loads? Or: how can I debug this?
As it turns out, the error was in settings.py. The tinymce location needs to be set like this:
TINYMCE_JS_ROOT = "articles/build/lib/node_modules/tinymce"
TINYMCE_JS_URL = os.path.join(TINYMCE_JS_ROOT, "tinymce.js")