Media Storage with Object Storage #17

Closed
opened 2025-03-21 13:19:10 +00:00 by tobru · 0 comments
Owner

Stories

As a user, I want to upload images and other attachments / files

Store media files on object storage and make it fully configurable.

Implementation Notes

Something like:


AWS_STORAGE_BUCKET_NAME = env.str("AWS_STORAGE_BUCKET_NAME", default=None)
AWS_S3_ENDPOINT_URL = env.str("AWS_S3_ENDPOINT_URL", default=None)
AWS_ACCESS_KEY_ID = env.str("AWS_ACCESS_KEY_ID", default=None)
AWS_SECRET_ACCESS_KEY = env.str("AWS_SECRET_ACCESS_KEY", default=None)
AWS_S3_REGION_NAME = "eu-central-1"
AWS_S3_ADDRESSING_STYLE = "virtual"
AWS_S3_SIGNATURE_VERSION = "s3v4"

# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
if all(
    [
        AWS_STORAGE_BUCKET_NAME,
        AWS_S3_ENDPOINT_URL,
        AWS_ACCESS_KEY_ID,
        AWS_SECRET_ACCESS_KEY,
    ]
):
    STORAGES["default"] = {
        "BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
        "OPTIONS": {
            "bucket_name": AWS_STORAGE_BUCKET_NAME,
            "endpoint_url": AWS_S3_ENDPOINT_URL,
            "access_key": AWS_ACCESS_KEY_ID,
            "secret_key": AWS_SECRET_ACCESS_KEY,
            "region_name": AWS_S3_REGION_NAME,
            "addressing_style": AWS_S3_ADDRESSING_STYLE,
            "signature_version": AWS_S3_SIGNATURE_VERSION,
        },
    }
## Stories _As a user, I want to upload images and other attachments / files_ Store media files on object storage and make it fully configurable. ## Implementation Notes * https://django-storages.readthedocs.io Something like: ``` AWS_STORAGE_BUCKET_NAME = env.str("AWS_STORAGE_BUCKET_NAME", default=None) AWS_S3_ENDPOINT_URL = env.str("AWS_S3_ENDPOINT_URL", default=None) AWS_ACCESS_KEY_ID = env.str("AWS_ACCESS_KEY_ID", default=None) AWS_SECRET_ACCESS_KEY = env.str("AWS_SECRET_ACCESS_KEY", default=None) AWS_S3_REGION_NAME = "eu-central-1" AWS_S3_ADDRESSING_STYLE = "virtual" AWS_S3_SIGNATURE_VERSION = "s3v4" # https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html if all( [ AWS_STORAGE_BUCKET_NAME, AWS_S3_ENDPOINT_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, ] ): STORAGES["default"] = { "BACKEND": "storages.backends.s3boto3.S3Boto3Storage", "OPTIONS": { "bucket_name": AWS_STORAGE_BUCKET_NAME, "endpoint_url": AWS_S3_ENDPOINT_URL, "access_key": AWS_ACCESS_KEY_ID, "secret_key": AWS_SECRET_ACCESS_KEY, "region_name": AWS_S3_REGION_NAME, "addressing_style": AWS_S3_ADDRESSING_STYLE, "signature_version": AWS_S3_SIGNATURE_VERSION, }, } ```
tobru added this to the Servala Portal MVP milestone 2025-03-21 13:19:10 +00:00
tobru added the
enhancement
label 2025-03-21 13:19:10 +00:00
tobru added this to the Servala Portal project 2025-03-21 13:19:10 +00:00
rixx closed this issue 2025-05-26 09:45:24 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: servala/servala-portal#17
No description provided.