0
Tests: OK
Version: FileBrowser 3.5.7, Grappelli 2.5.3, Django 1.6.10

Filebrowser 呈现奇怪的图像 URL。例如,/admin/filebrowser/browse/呈现这个:

<td class="fb_thumbnail">            
    <a href="/Users/mike/Projects/oi/adx/public/media/0b8d1ac8bb874a16c292260348065e3c.jpg" class="fb_viewlink"><img src="/Users/mike/Projects/oi/adx/public/media/_versions/0b8d1ac8bb874a16c292260348065e3c_admin_thumbnail.jpg" title="View Image"></a>            
</td>

它会创建缩略图,但由于某种原因,URL 是文件路径。

我的设置:

DEFAULT_FILE_STORAGE= 'django.core.files.storage.FileSystemStorage'
FILEBROWSER_DIRECTORY = '/Users/mike/Projects/oi/adx/public/media/'
FILEBROWSER_MEDIA_ROOT = '/Users/mike/Projects/oi/adx/public/media/'
FILEBROWSER_MEDIA_URL = '/media/'
FILEBROWSER_VERSIONS_BASEDIR = '/Users/mike/Projects/oi/adx/public/media/_versions'
MEDIA_ROOT = '/Users/mike/Projects/oi/adx/public/media/'
MEDIA_URL = '/media/'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = '/Users/mike/Projects/oi/adx/public/static'
STATIC_URL = '/static/'
4

1 回答 1

2

FILEBROWSER_DIRECTORY是相对的,所以FILEBROWSER_MEDIA_ROOT让它为空:

FILEBROWSER_DIRECTORY = ''

或限制到某个目录:

FILEBROWSER_DIRECTORY = 'uploads/'

另请注意FILEBROWSER_MEDIA_ROOT和与/FILEBROWSER_MEDIA_URL相同。这是默认设置,您可以安全地从.MEDIA_ROOTMEDIA_URLsettings.py

于 2015-03-05T21:57:36.973 回答