我面临着 django 文件浏览器和 django-tinymce 找不到的 404 对象。问题是,当我想选择一张之前上传的图片时,我无法在我的 HTMLField 中继续引入它。
这是我的设置:
TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True
TINYMCE_FILEBROWSER = True
# file_browser
# import filebrowser
# STATICFILES_DIRS += (os.path.join(os.path.dirname(filebrowser.__file__), 'static/'),)
ADMIN_MEDIA_PREFIX = '/media/admin/'
TINYMCE_JS_URL = ADMIN_MEDIA_PREFIX + 'tiny_mce/tiny_mce_src.js'
URL_FILEBROWSER_MEDIA = ADMIN_MEDIA_PREFIX + 'filebrowser/'
FILEBROWSER_URL_TINYMCE = ADMIN_MEDIA_PREFIX + 'tiny_mce/'
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/'
FILEBROWSER_EXTENSIONS = {
'Image': ['.jpg','.jpeg','.gif','.png','.tif','.tiff'],
'Video': ['.mov','.wmv','.mpeg','.mpg','.avi','.rm'],
'Audio': ['.mp3','.mp4','.wav','.aiff','.midi','.m4p']
}
FILEBROWSER_VERSIONS = {
'fb_thumb': {'verbose_name': 'Admin Thumbnail', 'width': 60, 'height': 60, 'opts': 'crop upscale'},
'thumbnail': {'verbose_name': 'Thumbnail (140px)', 'width': 140, 'height': '', 'opts': ''},
'small': {'verbose_name': 'Small (300px)', 'width': 300, 'height': '', 'opts': ''},
'medium': {'verbose_name': 'Medium (460px)', 'width': 460, 'height': '', 'opts': ''},
'big': {'verbose_name': 'Big (620px)', 'width': 620, 'height': '', 'opts': ''},
'cropped': {'verbose_name': 'Cropped (60x60px)', 'width': 60, 'height': 60, 'opts': 'crop'},
'croppedthumbnail': {'verbose_name': 'Cropped Thumbnail (140x140px)', 'width': 140, 'height': 140, 'opts': 'crop'},
}
FILEBROWSER_ADMIN_VERSIONS = ['thumbnail','small', 'medium','big']
FILEBROWSER_ADMIN_THUMBNAIL = ('fb_thumb')
网址
url(r'^admin/filebrowser/', include(site.urls)),
# url(r'^atmosphere/', include('atmosphere.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^tinymce/', include('tinymce.urls')),
(r'^grappelli/', include('grappelli.urls')),
已安装的应用程序:
'filebrowser',
'grappelli',
'tinymce',
'django.contrib.admin',
行政 :
class ArticleAdmin(admin.ModelAdmin):
# sets values for how the admin site lists your products
list_display = (u'title', u'author', u'created_at', u'pub_date',)
list_display_links = (u'title', u'created_at')
list_per_page = 20
ordering = [u'-created_at']
search_fields = [u'title', u'content', u'meta_keywords', u'meta_description']
# sets up slug to be generated from product title
prepopulated_fields = {u'slug': (u'title',)}
class Media:
js = (
'/static/tiny_mce/tiny_mce.js',
'modeltranslation/js/force_jquery.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js',
'modeltranslation/js/tabbed_translation_fields.js',
)
css = {'screen': ('modeltranslation/css/tabbed_translation_fields.css',),}
和错误
/media/admin/tiny_mce/tiny_mce_popup.js HTTP/1.1" 404 1729
我不知道该怎么做。如果您有任何建议,请提前感谢您!