Adapt to new storage syntax in settings
Removed the old, deprecated syntax and replaced it with the new one
This commit is contained in:
parent
b745afd91e
commit
c47b263302
|
|
@ -227,8 +227,6 @@ STATICFILES_DIRS = (
|
|||
os.path.join(BASE_DIR, "..", "client/src/assets"),
|
||||
)
|
||||
|
||||
if not TEST:
|
||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
|
||||
COMPRESS_CSS_FILTERS = [
|
||||
# 'django_compressor_autoprefixer.AutoprefixerFilter',
|
||||
|
|
@ -264,13 +262,24 @@ AWS_S3_CUSTOM_DOMAIN = "{}.s3-{}.amazonaws.com".format(
|
|||
AWS_STORAGE_BUCKET_NAME, os.environ.get("AWS_REGION", "eu-west-1")
|
||||
)
|
||||
if USE_AWS:
|
||||
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
||||
STORAGE_BACKEND = "storages.backends.s3boto3.S3Boto3Storage"
|
||||
# use with cloudfront
|
||||
MEDIA_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
|
||||
else:
|
||||
STORAGE_BACKEND = "django.core.files.storage.FileSystemStorage"
|
||||
MEDIA_URL = "/media/"
|
||||
MEDIA_ROOT = os.environ.get("DJANGO_MEDIAFILES", os.path.join(BASE_DIR, "media"))
|
||||
|
||||
if not TEST:
|
||||
STATICFILES_BACKEND = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
else:
|
||||
STATICFILES_BACKEND = "django.contrib.staticfiles.storage.StaticFilesStorage"
|
||||
|
||||
STORAGES = {
|
||||
"default": {"BACKEND": STORAGE_BACKEND},
|
||||
"staticfiles": {"BACKEND": STATICFILES_BACKEND},
|
||||
}
|
||||
|
||||
AWS_S3_OBJECT_PARAMETERS = {
|
||||
"CacheControl": "max-age=86400",
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue