From 0d16f7e7eb6c764efc5348df5a7f3712bd5a44a5 Mon Sep 17 00:00:00 2001 From: Moncef Abboud Date: Tue, 20 Feb 2024 17:46:33 +0100 Subject: [PATCH] fix: Update django-storages options The Open edX Quince release comes with a new django-storages version (1.14). New versions of django-storages have stricter checks for STORAGE_KWARGS. It is no longer allowed to have options from other storage classes, such as base_url, which is irrelevant to the S3 storage class. The bucket option has also been removed. It has been named bucket_name since django-storages 1.7 (even Open edX Lilac used 1.8, so there are no backward compatibility concerns); 1.10 dropped the "bucket" alias. Co-authored-by: Florian Haas --- CHANGELOG.md | 4 ++++ tutors3/patches/openedx-common-settings | 4 ++-- tutors3/patches/openedx-lms-common-settings | 5 +---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fe5a2f..f559fbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +* [Fix] Adjust options for django-storages 1.14. + ## Version 1.3.0 (2023-12-22) * [Enhancement] Support Tutor 17 and Open edX Quince. diff --git a/tutors3/patches/openedx-common-settings b/tutors3/patches/openedx-common-settings index 453e7af..4c7c49c 100644 --- a/tutors3/patches/openedx-common-settings +++ b/tutors3/patches/openedx-common-settings @@ -1,8 +1,8 @@ DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"] = VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"].lstrip("/") VIDEO_TRANSCRIPTS_SETTINGS["STORAGE_KWARGS"]["location"] = VIDEO_TRANSCRIPTS_SETTINGS["STORAGE_KWARGS"]["location"].lstrip("/") -GRADES_DOWNLOAD["STORAGE_KWARGS"]["location"] = GRADES_DOWNLOAD["STORAGE_KWARGS"]["location"].lstrip("/") -GRADES_DOWNLOAD["STORAGE_KWARGS"]["bucket"] = "{{ S3_GRADE_BUCKET }}" +GRADES_DOWNLOAD["STORAGE_KWARGS"] = {"location": GRADES_DOWNLOAD["STORAGE_KWARGS"]["location"].lstrip("/")} +GRADES_DOWNLOAD["STORAGE_KWARGS"]["bucket_name"] = "{{ S3_GRADE_BUCKET }}" ORA2_FILEUPLOAD_BACKEND = "s3" FILE_UPLOAD_STORAGE_BUCKET_NAME = "{{ S3_FILE_UPLOAD_BUCKET }}" diff --git a/tutors3/patches/openedx-lms-common-settings b/tutors3/patches/openedx-lms-common-settings index 7c804d7..ed92a79 100644 --- a/tutors3/patches/openedx-lms-common-settings +++ b/tutors3/patches/openedx-lms-common-settings @@ -2,12 +2,9 @@ PROFILE_IMAGE_BACKEND = { "class": DEFAULT_FILE_STORAGE, "options": { - "bucket": "{{ S3_PROFILE_IMAGE_BUCKET }}", + "bucket_name": "{{ S3_PROFILE_IMAGE_BUCKET }}", "location": PROFILE_IMAGE_BACKEND["options"]["location"].lstrip("/"), {% if S3_PROFILE_IMAGE_CUSTOM_DOMAIN %}"custom_domain": "{{ S3_PROFILE_IMAGE_CUSTOM_DOMAIN }}",{% endif %} - # A non empty base_url is necessary in development as it will be used - # to build a static url for the profile images. - "base_url": "dummyprofileimagebaseurl", }, } {% endif %} \ No newline at end of file