Tuesday, October 14, 2008

Practical Django Projects - TinyMCE Integration Issue

Following James Bennett's book, I got stalled in Chapter 3 (Customizing The Simple CMS) when I tried to integrate TinyMCE. The solution is rather simple, just move the tiny_mce entry in the urlpatterns one line up.

Here's my urls.py:
from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

urlpatterns = patterns('',
    # Example:
    # (r'^cms/', include('cms.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/(.*)', admin.site.root),
    (r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',
        { 'document_root':'C:\\dev\\python\\django\\media\\tinymce\\jscripts\\tiny_mce' },),
    (r'', include('django.contrib.flatpages.urls')),

By the way, this, this and this are excellent in outlining the code changes from Django 0.96 to 1.0, which should coincide with the book.


Anonymous said...

Thank you, this was very helpful for a Django n00b!