Default file storage s3 error media path

Hi,
I am getting the below error while running the application.

File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "/openedx/venv/lib/python3.8/site-packages/edxval/models.py", line 305, in VideoImage
    image = CustomizableImageField()
  File "/openedx/venv/lib/python3.8/site-packages/edxval/models.py", line 213, in __init__
    storage=get_video_image_storage(),
  File "/openedx/venv/lib/python3.8/site-packages/edxval/utils.py", line 158, in get_video_image_storage
    return get_storage_class(
  File "/openedx/venv/lib/python3.8/site-packages/storages/backends/s3boto3.py", line 250, in __init__
    check_location(self)
  File "/openedx/venv/lib/python3.8/site-packages/storages/utils.py", line 84, in check_location
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: S3Boto3Storage.location cannot begin with a leading slash. Found '/openedx/media/'. Use 'openedx/media/' instead

I tried with a patch using tutor plugins to remove the leading slash but the error still exists.

name: custom-settings
version: 0.1.0
patches:
  openedx-common-settings: |
     MEDIA_ROOT = "openedx/media/"
     DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

Tutor version 12.01(lilac)

Hi ashraf,

Set these under openedx-common-settings:

    VIDEO_IMAGE_SETTINGS["STORAGE_KWARGS"]["location"] = "openedx/media/"
    VIDEO_TRANSCRIPTS_SETTINGS["STORAGE_KWARGS"]["location"] = "openedx/media/"

This is caused by tutor using directly MEDIA_ROOT in the video structs when creating production.py settings files. The original playbook makes a finer work by checking if the default storage is s3 and removing the leading slash.

Are you using the tutor-minio plugin to host assets on S3? This plugin takes care of correctly defining these setting values (and they are highly non-trivial): https://github.com/overhangio/tutor-minio/blob/master/tutorminio/patches/openedx-common-settings

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.