Django and TinyMCE: NameError: name ‘url’ is not defined

I am trying to get TinyMCE working in Django. Here is what I did:

  • Using this package as a reference: django-tinymce4-lite
  • Successfully ran pip install django-tinymce4-lite; package installs fine
  • Added tinymce to INSTALLED_APPS in

Then here it gets tricky:

Add tinymce.urls to for your project:

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

When I do this, I get this error:

url(r'^tinymce/', include('tinymce.urls')),  
NameError: name 'url' is not defined

I have tried the following:

  • Restarting django
  • Instead of placing this in my project’s I have tried my app’s
  • I have tried to convert this to “path(‘tinymce/’, include(‘tinymce.urls’)),” because all other entries use ‘path’ and not ‘url’, but that didn’t work either (ModuleNotFoundError: No module named ‘tinymce.urls)
  • I have tried another tinymce plugin

None of this helped. Any suggestions?


As per the suggestions, I updated url to path. Now I have a new error:

ModuleNotFoundError: No module named 'tinymce.urls'

Here is my

from django.urls import include, path
from django.contrib import admin

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('', include('core.urls')),
    path('tinymce/', include('tinymce.urls')),

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

This error made me doubt if I had installed the plugin correctly. But it seems I have:

pip install django-tinymce4-lite
Requirement already satisfied: django-tinymce4-lite in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: Django>=1.8.0 in /usr/local/lib/python3.6/site-packages (from django-tinymce4-lite)
Requirement already satisfied: jsmin in /usr/local/lib/python3.6/site-packages (from django-tinymce4-lite)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from Django>=1.8.0->django-tinymce4-lite)


Since you are using django 2.0 you should use path instead of url:

from django.urls import path

urlpatterns = [
    path('tinymce/', include('tinymce.urls')),

You can find more details here.