TL DR - Tinymce formatting toolbar is not displayed. One line of django html generated seems suspicious, but I'm not sure why it is where it is. These are python 3.4 and django 1.8.
I have done this:
settings.py
I use django-tinymce defaults.
INSTALLED_APPS = ( ..., 'django.contrib.staticfiles', ..., 'tinymce', ... )
urls.py
... url(r'^tinymce/', include('tinymce.urls')) ... if settings.DEBUG: urlpatterns += patterns('django.views.static', (r'^media/(?P<path>.*)', 'serve', {'document_root': settings.MEDIA_ROOT}),) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
models.py
from tinymce.models import HTMLField class BlogEntry(models.Model): ...
(Documents suggest HTMLField. Other sources suggest TextField. The results remain the same.)
form.py
from tinymce.widgets import TinyMCE class BlogEntryForm(forms.ModelForm) article_body = forms.CharField( widget=TinyMCE(#mce_attrs={ #'plugin_preview_pageurl': reverse('tinymce-preview', "blog")}, attrs={ 'cols': 80, 'rows': 30, 'placeholder': 'contenu', 'class': 'lkz-input'}),)
template
{% extends "kernel/base.html" %} {% block extra_head %} {{ entry.media }} <script type="text/javascript" src="{% url "tinymce-js" "tinymce" %}"></script> {% endblock extra_head %} {% block content %} <form method="post" action=""> {% csrf_token %} ... {{ entry.article_body.errors }} <label for="{{ entry.article_body.id_for_label }}" ></label> {{ entry.article_body }}<br> ... </form>
which, I think, is a set of things that I needed to do. But the text box looks like a text box.
One rather strange thing (and the main suspect) is that I see that this HTML is being served:
<script type="text/javascript" src="/static/tiny_mce/tiny_mce.js"></script> <script type="text/javascript" src="/static/django_tinymce/init_tinymce.js"></script> <script type="text/javascript" src="/static/{% media %}/tiny_mce/tinymce.min.js"></script> <script type="text/javascript" src="/tinymce/js/textareas/tinymce/"></script>
/static/{% media %}/ on line 3 is clearly incorrect, although I donβt see where it comes from. The closest bit of the source I found is tinymce/settings.py , which is not identical (has no "min").
Fwiw, in case I configured it incorrectly, I have the following values:
STATIC_PATH = os.path.join(BASE_DIR,'static') STATIC_ROOT = '' STATIC_URL = '/static/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/'
side question
Tinymce docs (not django-tinymce) offer a selection of tinymce from a CDN. Django-tinymce packs it. Does anyone know what the benefit of this could be (besides local debugging)?