在撤换了所需的工作人员后,它开始了开发工作。但在生产中,它没有达到预期的效果,因为s3或ckeditor?

2024-04-24 12:09:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我的处境很奇怪。 我用的是django ckeditor,任何非工作人员都可以上传图片。但在制作中只有工作人员可以上传。我看了很多次文档,我不认为我遗漏了什么/ 有人能看看这是怎么回事吗?你知道吗

https://github.com/django-ckeditor/django-ckeditor

    #ckeditor
    CKEDITOR_UPLOAD_PATH = "media/"
    CKEDITOR_IMAGE_BACKEND = "pillow"
    CKEDITOR_ALLOW_NONIMAGE_FILES = False 
    CKEDITOR_RESTRICT_BY_USER = True
    CKEDITOR_REQUIRE_STAFF=False
    CKEDITOR_CONFIGS = {
        'default': {
    'toolbar': [["Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker"],
                    ['NumberedList', 'BulletedList', "Indent", "Outdent", 'JustifyLeft', 'JustifyCenter',
                     'JustifyRight', 'JustifyBlock'],
                    ["Image", "Table", "Link", "Unlink", "Anchor", "SectionLink", "Subscript", "Superscript"], ['Undo', 'Redo'], ["Source"],
                    ["Maximize"]],
            'uiColor': '#9AB8F3',


        },
    }
    AWS_DEFAULT_ACL = 'public-read'

    AWS_QUERYSTRING_AUTH = False



AWS_FILE_EXPIRE = 200
AWS_PRELOAD_METADATA = True
AWS_QUERYSTRING_AUTH = True

DEFAULT_FILE_STORAGE = 'ebagu.utils.MediaRootS3BotoStorage'
STATICFILES_STORAGE = 'ebagu.utils.StaticRootS3BotoStorage'
AWS_STORAGE_BUCKET_NAME = 'realebagu'
S3DIRECT_REGION = 'ap-northeast-2'
AWS_S3_HOST = "s3-ap-northeast-2.amazonaws.com"
S3_URL = '//%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
MEDIA_URL = '//%s.s3.amazonaws.com/media/' % AWS_STORAGE_BUCKET_NAME
MEDIA_ROOT = MEDIA_URL
STATIC_URL = S3_URL + 'static/'
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'

import datetime

date_two_months_later = datetime.date.today() + datetime.timedelta(2 * 365 / 12) 
expires = date_two_months_later.strftime("%A, %d %B %Y 20:00:00 GMT")

AWS_HEADERS = { 
    'Expires': expires,
    'Cache-Control': 'max-age=86400',
}

Tags: djangonamecomawsfalsetrueckeditorurl