我将在我的django平台中使用ckeditor。
我的设置是:
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, '')
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
MEDIA_ROOT = os.path.join(STATIC_ROOT, 'static/media')
MEDIA_URL = "/media/"
CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
CKEDITOR_MEDIA_PREFIX = "/media/ckeditor/"
CKEDITOR_UPLOAD_PREFIX = "http://fortezzeimperiali/media/uploads/"
CKEDITOR_RESTRICT_BY_USER = True
CKEDITOR_IMAGE_BACKEND = "pillow"但是当我浏览我的图像时,我得到了这个错误:
fortezzeimperiali/static/media/uploads/sega/2015/03/21/schermata-2014-11-30-alle-003712.png HTTP/1.1" 404 2857发布于 2015-03-22 04:23:27
我有一个对我来说总是有效的设置,也许你可以试试:
STATIC_URL = '/static/'
MEDIA_ROOT = ''
MEDIA_URL = '/media/'
STATIC_ROOT = 'static'
# CKEditor settings
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
#This ensures you have all toolbar icons
CKEDITOR_CONFIGS = {
'default': {
'toolbar': None,
},
}当然,您应该在已安装的应用程序中安装ckeditor
....
'ckeditor',
...并将ckeditor添加到urls:
(r'^ckeditor/', include('ckeditor.urls')),我相信你已经看过这个页面了:https://github.com/django-ckeditor/django-ckeditor
发布于 2015-06-02 21:07:14
也许你应该使用一个有效的域名,而不是只使用fortezzeimperiali?
KEDITOR_UPLOAD_PREFIX = "http://fortezzeimperiali.com/media/uploads/“
发布于 2016-07-09 03:19:33
如果一切正常,但是镜像没有被抓取,也许你在安装之后忘记运行python manage.py collectstatic了?
或者,如果只是在图像浏览器中看不到缩略图的问题(但当您单击损坏的缩略图时会看到预览),那么您只需要运行python manage.py generateckeditorthumbnails来为服务器上已有的图像生成缩略图。那些不在那里的人会导致你看到一些404通过网络出现,但不会导致网站崩溃或其他任何事情。但是,如果是这样的话,运行该命令将使它们消失。
https://stackoverflow.com/questions/29186343
复制相似问题