2011-09-08 109 views
5

所以我试图让filebrowser在django中使用tinymce。 Evilthing可以和tinymce,漂亮的花哨文本编辑器一起使用。当我尝试打开文件浏览器时,我在/ admin/filebrowser/browse/ 上得到了错误配置错误发现上传文件夹(MEDIA_ROOT + DIRECTORY)。也许它不存在,我不从在控制台中的任何错误,到目前为止,我可以告诉它应该寻找/媒体/ filebrowser /这肯定存在Django-tinymce和django-filebrowser,图片上传错误查找上传文件夹(MEDIA_ROOT + DIRECTORY)

python manage.py test filebrowser give me this: 

FAIL: test_directory (filebrowser.tests.settings.SettingsTests) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/home/nada/costumeshoppe/filebrowser/tests/settings.py", line 29, in test_directory 
    self.assertEqual(os.path.exists(os.path.join(MEDIA_ROOT,DIRECTORY)), 1) 

Asse田:?!假= 1个

我的设置:

STATIC_ROOT = ROOT_PATH +'/public/static/' 
STATIC_URL = '/static/' 
MEDIA_ROOT = ROOT_PATH + '/public/media/' 
MEDIA_URL = '/media/' 
TINYMCE_JS_ROOT = '/static/tiny_mce/' 
TINYMCE_JS_URL = os.path.join(STATIC_URL, "tiny_mce/tiny_mce_src.js") 
TINYMCE_DEFAULT_CONFIG = { 
    'plugins': "table,spellchecker,paste,searchreplace,styles", 
    'theme': "advanced", 
} 

我的网址:

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

urlpatterns += staticfiles_urlpatterns() 

我在调试m跑噢,不知道这是否是问题,有一个奇怪的问题,我可以使用静态url加载静态文件,但他们必须在媒体目录中,尽管filebrowser静态文件位于我的静态文件位置一些安装问题,但将这些文件放在媒体位置也没有改变任何东西。任何想法需要做什么才能使其发挥作用?

+0

目录在filebrowser.settings默认设置为上载/没有这个文件夹的媒体根内部存在? – JamesO

+0

以为我做过了,但再次检查它不在那里,可能在某个地方浮动。任何如何双重检查一切,弹出窗口打开,显示图像,但点击选择不做任何事情,我得到FileBrowserDiologue没有定义,继续阅读文档,但任何帮助表示赞赏(我真的希望能够浏览本地文件夹,但可能无法使用filebrowser?) – Christopher

+0

如何将此标记为已回答?因为这确实是我想给你的答案。 – Christopher

回答

3

DIRECTORY在filebrowser.settings中默认设置为上传/该文件夹是否存在于您的媒体根目录中?

此默认可以在你的settings.py改变与FILEBROWSER_DIRECTORY

11

默认FILEBROWSER_DIRECTORY是“上传”,所以你应该检查一下“/媒体/上传”存在

0

如果任何人有同样的问题,请read this post。它为我工作。

摘编为后人内容:

If you want to use tinymce widget to edit zinnia blog posts you may also want to use filebrowser to insert/edit images using your media django media folder. It does not work out of the box.

  • install zinnia
  • install filebrowser
  • install django-tinymce

And create your own file admin/zinnia/entry/tinymce_textareas.js with content:

tinyMCE.init({ 
    file_browser_callback: "djangoFileBrowser", // <---- this makes filebrowser work! 
    mode: "exact", 
    elements: "id_content", 
    theme: "advanced", 
    skin_variant : "silver", 
    height: "250", 
    width: "800", 
    relative_urls: false, 
    language: "en", 
    directionality: "ltr", 
    spellchecker_languages : "Arabic=ar,Azerbaijani=az,Bulgarian=bg,Bengali=bn,Bosnian=bs,Catalan=ca,Czech=cs,Welsh=cy,Danish=da,German=de,Greek=el,+English/British English=en,Esperanto=eo,Spanish/Argentinian Spanish/Mexican Spanish/Nicaraguan Spanish=es,Estonian=et,Basque=eu,Persian=fa,Finnish=fi,French=fr,Frisian=fy,Irish=ga,Galician=gl,Hebrew=he,Hindi=hi,Croatian=hr,Hungarian=hu,Indonesian=id,Icelandic=is,Italian=it,Japanese=ja,Georgian=ka,Kazakh=kk,Khmer=km,Kannada=kn,Korean=ko,Lithuanian=lt,Latvian=lv,Macedonian=mk,Malayalam=ml,Mongolian=mn,Norwegian Bokmal=nb,Nepali=ne,Dutch=nl,Norwegian Nynorsk=nn,Punjabi=pa,Polish=pl,Portuguese/Brazilian Portuguese=pt,Romanian=ro,Russian=ru,Slovak=sk,Slovenian=sl,Albanian=sq,Serbian/Serbian Latin=sr,Swedish=sv,Swahili=sw,Tamil=ta,Telugu=te,Thai=th,Turkish=tr,Tatar=tt,Ukrainian=uk,Urdu=ur,Vietnamese=vi,Simplified Chinese/Traditional Chinese=zh", 
    spellchecker_rpc_url : "", 
    theme_advanced_toolbar_location : "top", 
    theme_advanced_toolbar_align : "left", 
    theme_advanced_statusbar_location : "bottom", 
    theme_advanced_resizing : true, 
    plugins: "contextmenu,directionality,fullscreen,paste,preview,searchreplace,spellchecker,visualchars,wordcount", 
    paste_auto_cleanup_on_paste : true, 
    theme_advanced_buttons1 : "formatselect,fontsizeselect,|,undo,redo,|,cut,copy,paste,pastetext,pasteword,|,search,replace,|,visualchars,visualaid,cleanup,code,preview,fullscreen", 
    theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,forecolor,backcolor,removeformat,|,justifyleft,justifycenter,justifyright,justifyfull,|,sub,sup,|,bullist,numlist,|,outdent,indent,|,link,unlink,anchor,image,blockquote,hr,charmap,", 
    theme_advanced_buttons3 : "" 
});