django-cms、django flatpages、tiny mce 不显示

发布于 2024-07-19 07:23:13 字数 1922 浏览 9 评论 0原文

我已经实现了 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 就没有多大用处。

谢谢

I've implemented both django-cms and flatpages, but can not get tiny_mce to display in either.

urls.py

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

from django.conf import settings
if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^site_media/(?P<path>.*)

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)

In the base.html file

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

There are so many different options when accessing the various user groups, docs, etc. I'm not sure what is the correct syntax. The CMS doesn't do me much good without some kind of text editor.

Thx

, 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), )

settings.py

admin.py

In the base.html file

There are so many different options when accessing the various user groups, docs, etc. I'm not sure what is the correct syntax. The CMS doesn't do me much good without some kind of text editor.

Thx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

_失温 2024-07-26 07:23:13

首先,请使用斜杠检查此行,例如:

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

最好的,
米科拉·里斯。

first of all please check this line with slash like:

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

also please check site_id in error logs. had similar issue with site_id because I created new site with different id.

Best,
Mykola Lys.

中二柚 2024-07-26 07:23:13

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

If you need some more features then the simple flatpages just checkout django-blocks (http://code.google.com/p/django-blocks/). Has multi-language Menu, Flatpages and even has a simple Shopping Cart!!

我只土不豪 2024-07-26 07:23:13

您是否阅读过 Django wiki 上的 TinyMCE 页面? 另外 - 尽管它看起来可能不适用于您 - 浏览器阻止跨不同服务器/域的脚本调用...

Have you read the TinyMCE page on the Django wiki? Also - although it looks like it might not apply to you - browsers block calls from scripts across differing servers/domains...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文