django-cms,django flatpages,小mce没有显示

时间:2009-05-07 18:32:49

标签: django tinymce django-flatpages

我已经实现了django-cms和flatpages,但是无法在其中显示tiny_mce。

urls.py

(r'^tinymce/', include('tinymce.urls')),

from django.conf import settings
if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
                {'document_root': settings.MEDIA_ROOT}),
        )

settings.py

TINYMCE_JS_URL = 'http://127.0.0.1:8000/site_media/js/tiny_mce/tiny_mce.js'
TINYMCE_JS_ROOT = 'http://127.0.0.1:8000/site_media/js/tinymce/'
TINYMCE_DEFAULT_CONFIG = {
   'plugins': "table,spellchecker,paste,searchreplace",
   'theme': "advanced",
    'cleanup_on_startup': True,
    'custom_undo_redo_levels': 10,
}

TINYMCE_SPELLCHECKER = False
TINYMCE_COMPRESSOR = False
TINYMCE_FILEBROWSER = True
CMS_USE_TINYMCE = True

admin.py

from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin
#Flatpages
class FlatPageAdmin(FlatPageAdmin):
    class Media:
        js = ('http://127.0.0.1:8000/js/tiny_mce/tiny_mce.js',
              'http://127.0.0.1:8000/js/tiny_mce/textareas.js',)

# We have to unregister it, and then reregister
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageAdmin)
#django-cms
from myprograms.cms.models import Page
class PageOptions(admin.ModelAdmin):
    class Media:
        js = ('http://127.0.0.1:8000/site_media/js/tiny_mce/tiny_mce.js',
              'http://127.0.0.1:8000/site_media/js/tiny_mce/textareas.js')
#admin.site.register(Page, PageOptions)

在base.html文件中

<script type="text/javascript" src="{{ MEDIA_URL }}js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="{% url tinymce-js "NAME" %}"></script>

访问各种用户组,文档等时有很多不同的选项。我不确定正确的语法是什么。如果没有某种文本编辑器,CMS对我没那么好。

Thx

3 个答案:

答案 0 :(得分:2)

首先请用斜线检查此行:

<script type="text/javascript" src="{{ MEDIA_URL }}/js/tiny_mce/tiny_mce.js"></script>

另请检查错误日志中的site_id。与site_id有类似的问题,因为我创建了具有不同ID的新网站。

最佳, Mykola Lys。

答案 1 :(得分:1)

如果您需要更多功能,那么简单的flatpages只需检查django-blocks(http://code.google.com/p/django-blocks/)。有多语言菜单,Flatpages甚至有一个简单的购物车!!

答案 2 :(得分:0)

您是否阅读过TinyMCE page on the Django wiki?此外 - 虽然看起来它可能不适用于您 - browsers block calls from scripts across differing servers/domains ...