From 2f8475c307edd6a60711cbd0be22dda108f55a3e Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Mon, 28 Aug 2023 14:46:21 +0500 Subject: [PATCH] Revert "Revert "feat!: upgrading django-storages to 1.10.1 (#32571)" (#33109)" (#33111) This reverts commit 191b825a2ce982cd8c1f3e560f1f69f4cf2e3535. --- cms/djangoapps/contentstore/tests/test_video_utils.py | 3 +-- cms/envs/common.py | 4 ++-- cms/envs/devstack-experimental.yml | 6 +++--- cms/envs/test.py | 2 +- cms/urls.py | 4 ++-- lms/envs/common.py | 5 +++-- lms/envs/devstack-experimental.yml | 8 ++++---- requirements/constraints.txt | 5 ++--- requirements/edx/base.txt | 2 +- requirements/edx/development.txt | 2 +- requirements/edx/doc.txt | 2 +- requirements/edx/testing.txt | 2 +- 12 files changed, 22 insertions(+), 23 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_video_utils.py b/cms/djangoapps/contentstore/tests/test_video_utils.py index 103c8179a710..5ba7384dba2b 100644 --- a/cms/djangoapps/contentstore/tests/test_video_utils.py +++ b/cms/djangoapps/contentstore/tests/test_video_utils.py @@ -389,7 +389,7 @@ def test_video_backend(self): @override_settings(VIDEO_IMAGE_SETTINGS={ 'STORAGE_CLASS': 'storages.backends.s3boto3.S3Boto3Storage', 'STORAGE_KWARGS': - {'bucket_name': 'test', 'default_acl': None, 'base_url': '/', 'location': 'abc/def'}} + {'bucket_name': 'test', 'default_acl': None, 'location': 'abc/def'}} ) def test_boto3_backend_with_params(self): storage = get_storage_class( @@ -417,7 +417,6 @@ def test_storage_without_global_default_acl_setting(self): obj.upload_fileobj.assert_called_with( content, ExtraArgs={ - 'ACL': 'public-read', # it will come from 1.9.1 'ContentType': 'text/plain', } ) diff --git a/cms/envs/common.py b/cms/envs/common.py index e79961337197..a0ae0f00541c 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2504,9 +2504,9 @@ # STORAGE_KWARGS=dict(bucket='video-image-bucket'), STORAGE_KWARGS=dict( location=MEDIA_ROOT, - base_url=MEDIA_URL, ), DIRECTORY_PREFIX='video-images/', + BASE_URL=MEDIA_URL, ) VIDEO_IMAGE_MAX_AGE = 31536000 @@ -2519,9 +2519,9 @@ # STORAGE_KWARGS=dict(bucket='video-transcripts-bucket'), STORAGE_KWARGS=dict( location=MEDIA_ROOT, - base_url=MEDIA_URL, ), DIRECTORY_PREFIX='video-transcripts/', + BASE_URL=MEDIA_URL, ) VIDEO_TRANSCRIPTS_MAX_AGE = 31536000 diff --git a/cms/envs/devstack-experimental.yml b/cms/envs/devstack-experimental.yml index 08cb101f5fb8..61a94c4bc5a9 100644 --- a/cms/envs/devstack-experimental.yml +++ b/cms/envs/devstack-experimental.yml @@ -512,17 +512,17 @@ VIDEO_IMAGE_MAX_AGE: 31536000 VIDEO_IMAGE_SETTINGS: DIRECTORY_PREFIX: video-images/ STORAGE_KWARGS: - base_url: /media/ location: /edx/var/edxapp/media// VIDEO_IMAGE_MAX_BYTES: 2097152 VIDEO_IMAGE_MIN_BYTES: 2048 + BASE_URL: /media/ VIDEO_TRANSCRIPTS_MAX_AGE: 31536000 VIDEO_TRANSCRIPTS_SETTINGS: DIRECTORY_PREFIX: video-transcripts/ STORAGE_KWARGS: - base_url: /media/ - location: /edx/var/edxapp/media// + location: edx/var/edxapp/media// VIDEO_TRANSCRIPTS_MAX_BYTES: 3145728 + BASE_URL: /media/ VIDEO_UPLOAD_PIPELINE: BUCKET: '' ROOT_PATH: '' diff --git a/cms/envs/test.py b/cms/envs/test.py index 118b3f1b0c33..ebaaf09171f8 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -303,9 +303,9 @@ VIDEO_IMAGE_MIN_BYTES=2 * 1024, # 2 KB STORAGE_KWARGS=dict( location=MEDIA_ROOT, - base_url=MEDIA_URL, ), DIRECTORY_PREFIX='video-images/', + BASE_URL=MEDIA_URL, ) VIDEO_IMAGE_DEFAULT_FILENAME = 'default_video_image.png' diff --git a/cms/urls.py b/cms/urls.py index ffbd9f9298e0..5e5674d1ec78 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -277,12 +277,12 @@ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static( - settings.VIDEO_IMAGE_SETTINGS['STORAGE_KWARGS']['base_url'], + settings.VIDEO_IMAGE_SETTINGS['BASE_URL'], document_root=settings.VIDEO_IMAGE_SETTINGS['STORAGE_KWARGS']['location'] ) urlpatterns += static( - settings.VIDEO_TRANSCRIPTS_SETTINGS['STORAGE_KWARGS']['base_url'], + settings.VIDEO_TRANSCRIPTS_SETTINGS['BASE_URL'], document_root=settings.VIDEO_TRANSCRIPTS_SETTINGS['STORAGE_KWARGS']['location'] ) diff --git a/lms/envs/common.py b/lms/envs/common.py index a2666d3d6701..d150eac6580b 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -3801,9 +3801,10 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring # STORAGE_KWARGS=dict(bucket='video-image-bucket'), STORAGE_KWARGS=dict( location=MEDIA_ROOT, - base_url=MEDIA_URL, ), DIRECTORY_PREFIX='video-images/', + BASE_URL=MEDIA_URL, + ) VIDEO_IMAGE_MAX_AGE = 31536000 @@ -3817,9 +3818,9 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring # STORAGE_KWARGS=dict(bucket='video-transcripts-bucket'), STORAGE_KWARGS=dict( location=MEDIA_ROOT, - base_url=MEDIA_URL, ), DIRECTORY_PREFIX='video-transcripts/', + BASE_URL=MEDIA_URL, ) VIDEO_TRANSCRIPTS_MAX_AGE = 31536000 diff --git a/lms/envs/devstack-experimental.yml b/lms/envs/devstack-experimental.yml index e69656a80340..17dadd7e1aa6 100644 --- a/lms/envs/devstack-experimental.yml +++ b/lms/envs/devstack-experimental.yml @@ -614,17 +614,17 @@ VIDEO_IMAGE_MAX_AGE: 31536000 VIDEO_IMAGE_SETTINGS: DIRECTORY_PREFIX: video-images/ STORAGE_KWARGS: - base_url: /media/ - location: /edx/var/edxapp/media// + location: edx/var/edxapp/media// VIDEO_IMAGE_MAX_BYTES: 2097152 VIDEO_IMAGE_MIN_BYTES: 2048 + BASE_URL: /media/ VIDEO_TRANSCRIPTS_MAX_AGE: 31536000 VIDEO_TRANSCRIPTS_SETTINGS: DIRECTORY_PREFIX: video-transcripts/ STORAGE_KWARGS: - base_url: /media/ - location: /edx/var/edxapp/media// + location: edx/var/edxapp/media// VIDEO_TRANSCRIPTS_MAX_BYTES: 3145728 + BASE_URL: /media/ VIDEO_UPLOAD_PIPELINE: BUCKET: '' ROOT_PATH: '' diff --git a/requirements/constraints.txt b/requirements/constraints.txt index d5b6ad8e224e..3d48588b0602 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -20,9 +20,8 @@ celery>=5.2.2,<6.0.0 # required for celery>=5.2.0;<5.3.0 click>=8.0,<9.0 -# django-storages version 1.9 drops support for boto storage backend. -# 1.9 gives an error for details https://github.com/jschneier/django-storages/issues/831 -django-storages==1.9.1 +# django-storages version 1.10.1 is major upgrade and require multiple settings changes. +django-storages==1.10.1 # The team that owns this package will manually bump this package rather than having it pulled in automatically. diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 5f33f5483678..e9455161c823 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -357,7 +357,7 @@ django-statici18n==2.4.0 # -r requirements/edx/kernel.in # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.9.1 +django-storages==1.10.1 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/kernel.in diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 9910c3fe01e4..c95115645b17 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -570,7 +570,7 @@ django-statici18n==2.4.0 # -r requirements/edx/testing.txt # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.9.1 +django-storages==1.10.1 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/doc.txt diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index 312aa749ba88..e74977b70af6 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -420,7 +420,7 @@ django-statici18n==2.4.0 # -r requirements/edx/base.txt # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.9.1 +django-storages==1.10.1 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.txt diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 6f3abc3d973c..53e3ae011ed6 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -452,7 +452,7 @@ django-statici18n==2.4.0 # -r requirements/edx/base.txt # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.9.1 +django-storages==1.10.1 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.txt