Lynob
Lynob

Reputation: 5337

Django: how to install tinymce?

1- I want to install tinymce. not django-tinymce (for some reason)

2-I don't want to do it using the admin.py method (for some reason)


I want to do it my way:

in urls.py:

from django.conf.urls.defaults import patterns, include, url

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

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'cms.views.home', name='home'),
    # url(r'^cms/', include('cms.foo.urls')),

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

    # Uncomment the next line to enable the admin:
     (url(r'^admin/', include(admin.site.urls)),
      (r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',
                               { 'document_root': 'C:/Documents and Settings/Administrator/Desktop/django-projects/cms/javascript/tinymce/jscripts/tiny_mce' },

    )))

in admin/flatpages/flatpage/change_form.html

<script type="text/javascript" src="{{ jsi18nurl|default:"../../../jsi18n/" }}"></script>
<script type="text/javascript" src="/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
theme: "simple"
});

2 days ago i didn't get any errors but tinymce won't show, now, I tried to do it again and i get this error

invalid syntax (urls.py, line 22)

UPDATE

invalid syntax (urls.py, line 22) is gone

now i see dictionary update sequence element #0 has length 23; 2 is required

@Denis Kabalkin

IF i do it like this

from django.conf.urls.defaults import patterns, include, url

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

urlpatterns = patterns('',
     url(r'^admin/', include(admin.site.urls),
     url(r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',
                               { 'document_root': 'C:/Documents and Settings/Administrator/Desktop/django-projects/cms/javascript/tinymce/jscripts/tiny_mce' }),
)

I get invalid syntax (urls.py, line 12)

IF I do it like this

from django.conf.urls.defaults import patterns, include, url

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

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'cms.views.home', name='home'),
    # url(r'^cms/', include('cms.foo.urls')),

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

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    url(r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',{ 'document_root': 'C:/Documents and Settings/Administrator/Desktop/django-projects/cms/javascript/tinymce/jscripts/tiny_mce'}),
    )

I'll see no error but TinyMce will not be displayedenter image description here

Upvotes: 0

Views: 1568

Answers (2)

Denis Kabalkin
Denis Kabalkin

Reputation: 508

This fixes the errors in urls.py:

from django.conf.urls.defaults import patterns, include, url

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

urlpatterns = patterns('',
     url(r'^admin/', include(admin.site.urls),
     url(r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',
                               { 'document_root': 'C:/Documents and Settings/Administrator/Desktop/django-projects/cms/javascript/tinymce/jscripts/tiny_mce' }),
)

Here is docs.

Upvotes: 1

dm03514
dm03514

Reputation: 55972

It looks like you are missing a closing parenthesis on line 22

Upvotes: 0

Related Questions