2011-11-20 76 views
0

1-我想安裝tinymce。不django-tinymce出於某種原因Django:如何安裝tinymce?

2 - 我不想使用admin.py方法(出於某種原因


我想這樣做,它做的事情我的方法:

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' }, 

    ))) 

管理員/的flatpages /簡單頁面/ 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" 
}); 

3天前,我沒有得到任何錯誤,但TinyMCE的不會顯示,現在,我試着做一遍,我也得到這個錯誤

invalid syntax (urls.py, line 22) 

UPDATE

invalid syntax (urls.py, line 22)不見了

現在我看到dictionary update sequence element #0 has length 23; 2 is required

@Denis Kabalkin稱

IF我不喜歡這樣

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' }), 
) 

我得到invalid syntax (urls.py, line 12)

IF我不喜歡這樣

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'}), 
    ) 

我看不出有什麼錯誤,但TinyMCE的將不被顯示enter image description here

+0

你使用什麼版本的tinymce? –

回答

3

此修復這些錯誤在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' }), 
) 

這裏是docs

+0

請閱讀我的編輯 – Lynob

+0

沒有括號沒有工作 – Lynob

+0

[此](http://pastebin.com/ZxkRpHX5)應該有幫助 –

0

它看起來像你缺少上線右括號22

+0

我缺少2個括號:)現在錯誤消失,但我有這個錯誤:字典更新序列元素#0有長度23; 2是必填項 – Lynob