Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django ckeditor文件上传不';行不通_Django_Python 3.x_Django Ckeditor - Fatal编程技术网

Django ckeditor文件上传不';行不通

Django ckeditor文件上传不';行不通,django,python-3.x,django-ckeditor,Django,Python 3.x,Django Ckeditor,我在我的博客中使用django ckeditor模块作为所见即所得编辑器在管理中创建和编辑文章。它工作得很好,但我不能上传图像到我的服务器。当我点击图片按钮时,按钮“浏览服务器”和“上传图片”并不像他们想象的那样出现(我在某处看到过)。我只能添加提供URL的外部图像。 我在Python3.4中使用Django 1.8 模块django ckeditor和ckeditor_上传程序已正确安装并添加到已安装的_应用程序中 这是my settings.py文件: import os BASE_DIR

我在我的博客中使用django ckeditor模块作为所见即所得编辑器在管理中创建和编辑文章。它工作得很好,但我不能上传图像到我的服务器。当我点击图片按钮时,按钮“浏览服务器”和“上传图片”并不像他们想象的那样出现(我在某处看到过)。我只能添加提供URL的外部图像。 我在Python3.4中使用Django 1.8

模块django ckeditor和ckeditor_上传程序已正确安装并添加到已安装的_应用程序中

这是my settings.py文件:

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

DEBUG = True

ALLOWED_HOSTS = []

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog',
    'ckeditor',
    'ckeditor_uploader',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'django-mini-blog.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'django.template.context_processors.media',
            ],
        },
    },
]

WSGI_APPLICATION = 'django-mini-blog.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

LANGUAGE_CODE = 'fr-fr'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = '/static/'

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

CKEDITOR_UPLOAD_PATH = "uploads/"

CKEDITOR_IMAGE_BACKEND = "pillow"
提前感谢你的帮助


诚恳地说,

您是否在URL.py文件中添加了以下代码

    urlpatterns = patterns(
    '',
    ....
    (r'^ckeditor/', include('ckeditor.urls')),

)

我在我的项目url.py中有
url(r'^ckeditor/',include('ckeditor\u uploader.url')),
。无法识别ckeditor.url,我使用它时遇到了一个导入错误:没有名为“ckeditor.url”的模块您使用的是什么版本?在4.5.1()之后的版本中进行了一些向后不兼容的更改。我相信您的设置对于4.5.1版是正确的,或者将您的URL.py更改为(r“^ckeditor/”,include('ckeditor_uploader.url'))