【发布时间】:2021-07-20 01:55:56
【问题描述】:
我的设置
...
AWS_ACCESS_KEY_ID = 'MY_KEY'
AWS_SECRET_ACCESS_KEY = 'MY_SECRET_KEY'
AWS_STORAGE_BUCKET_NAME = 'wallpapers'
AWS_S3_ENDPOINT_URL = 'https://sgp1.digitaloceanspaces.com'
AWS_S3_CUSTOM_DOMAIN = 'wallpapers.sgp1.cdn.digitaloceanspaces.com'
AWS_QUERYSTRING_AUTH = False
AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400',
}
AWS_LOCATION = 'static'
AWS_DEFAULT_ACL = 'public-read'
STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION)
MEDIA_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, 'media')
MEDIA_ROOT = 'media/'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
...
当我打开“http://127.0.0.1:8000/”时
这会导致高 TTFB...
但是当我在 settings.py 中注释掉/删除它时...
#DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
然后一切正常
【问题讨论】:
标签: python django amazon-s3 digital-ocean django-storage