From 08d80ac5adea599eccba1d5bea08a5a27368e7c1 Mon Sep 17 00:00:00 2001 From: Drew Winstel Date: Mon, 22 May 2023 14:47:03 -0500 Subject: [PATCH] Fix storage definition for Django 4.2 (#479) --- hsv_dot_beer/config/production.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hsv_dot_beer/config/production.py b/hsv_dot_beer/config/production.py index 75d4ad67..42ff97d3 100644 --- a/hsv_dot_beer/config/production.py +++ b/hsv_dot_beer/config/production.py @@ -11,11 +11,18 @@ class Production(Common): INSTALLED_APPS += ("gunicorn",) # Static files (CSS, JavaScript, Images) - # https://docs.djangoproject.com/en/2.0/howto/static-files/ + # https://docs.djangoproject.com/en/4.2/howto/static-files/ # http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ("storages",) - DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" - STATICFILES_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" + STORAGES = { + "default": { + "BACKEND": "storages.backends.s3boto3.S3Boto3Storage", + }, + "staticfiles": { + # Leave whatever setting you already have here, e.g.: + "BACKEND": "storages.backends.s3boto3.S3Boto3Storage", + }, + } AWS_ACCESS_KEY_ID = os.getenv("DJANGO_AWS_ACCESS_KEY_ID") AWS_SECRET_ACCESS_KEY = os.getenv("DJANGO_AWS_SECRET_ACCESS_KEY") AWS_STORAGE_BUCKET_NAME = os.getenv("DJANGO_AWS_STORAGE_BUCKET_NAME")