集成django-tinymce和django-filebrowser

时间:2012-03-19 14:18:15

标签: django django-tinymce django-filebrowser

我正在编写一个小型django应用程序,它允许用户使用安装了django-tinymce的tinymce编辑器发布消息。一切正常,但是当我尝试添加django-filebrowser来安装应用程序时,tinymce小部件会从帖子表单中消失。我已经安装了grappelli和PIL库。它适用于/ admin / filebrowser / browse。我可以上传文件,但缩略图不显示。 Django-filebrowser无法通过测试:

python2.6 manage.py test filebrowser 
Creating Test for the FileBrowser site: filebrowser 
Creating test database for alias 'default'... 
..................uploads/tmp_test_0/testimage_medium.jpg 
FRemoving left-over tmp dir: uploads/tmp_test_0 
====================================================================== 
FAIL: runTest (filebrowser.tests.sites.TestSite_filebrowser) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
  File "/usr/local/lib/python2.6/dist-packages/filebrowser/tests/ 
sites.py", line 233, in runTest 
    test_detail(self) 
  File "/usr/local/lib/python2.6/dist-packages/filebrowser/tests/ 
sites.py", line 140, in test_detail 
    test.assertTrue(test.site.storage.exists(path)) 
AssertionError: False is not True 
---------------------------------------------------------------------- 
Ran 19 tests in 1.114s 
FAILED (failures=1) 
Destroying test database for alias 'default'... 

我正在使用filebroswer 3.41,django-tinymce 1.5.1b2,PIL 1.1.7,grappelli 2.3.7

我的祝贺:

PROJECT_PATH = os.path.realpath(os.path.dirname(__file__)) 
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media/') 
MEDIA_URL = '/media/' 
STATIC_ROOT = os.path.join(PROJECT_PATH, 'static/') 
STATIC_URL = '/static/' 
TINYMCE_JS_URL = STATIC_URL + 'tiny_mce/tiny_mce.js' 
TINYMCE_DEFAULT_CONFIG = {'theme': "advanced", } 
TINYMCE_FILEBROWSER = True 
# Filebrowser 
FILEBROWSER_MEDIA_ROOT = MEDIA_ROOT 
FILEBROWSER_MEDIA_URL = MEDIA_URL 
FILEBROWSER_STATIC_ROOT = STATIC_ROOT 
FILEBROWSER_STATIC_URL = STATIC_URL 
URL_FILEBROWSER_MEDIA = STATIC_URL + 'filebrowser/' 
PATH_FILEBROWSER_MEDIA = STATIC_ROOT + 'filebrowser/' 
URL_TINYMCE = STATIC_URL + 'tiny_mce/' 
PATH_TINYMCE = STATIC_ROOT + 'tiny_mce/' 

/mainprojectfolder/static/tiny_mce/tiny_mce.js中的tinymce文件

urls.py:

    url(r'^admin/', include(admin.site.urls)), 
    url(r'^admin/filebrowser/', include(site.urls)), name='tinymce-filebrowser'), 
    (r'baza/', include('projekt.baza.urls')), 
    (r'^grappelli/', include('grappelli.urls')), 
    (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, 'show_indexes':True}),
    (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),

我怎样才能让它发挥作用?

0 个答案:

没有答案