Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS_S3_CUSTOM_DOMAIN usage #263

Open
Mirrormsk opened this issue Sep 24, 2024 · 0 comments
Open

AWS_S3_CUSTOM_DOMAIN usage #263

Mirrormsk opened this issue Sep 24, 2024 · 0 comments

Comments

@Mirrormsk
Copy link

Hi!

I'm using the plugin, and it works great. There are some differences after migrating from django-storages. I had to add the bucket prefix to AWS_S3_ENDPOINT_URL: https://<bucket_name>.old.s3.url instead of https://old.s3.url as it was before (this may be a peculiarity of my storage).

Also, I previously used AWS_S3_CUSTOM_DOMAIN with a public domain. To make everything work again, I had to override the form:

class VideoLessonAdminForm(forms.ModelForm):
    class Meta:
        model = VideoLesson
        fields = [
            "title",
            "description",
            "file",
            "poster",
            "lesson_page",
            "is_published",
        ]
        widgets = {
            "file": S3DirectWidget(dest="videos"),
        }

    def clean_file(self):
        value = self.cleaned_data.get("file")

        custom_domain = getattr(settings, "AWS_S3_CUSTOM_DOMAIN", None)
        aws_endpoint_url = getattr(settings, "AWS_S3_ENDPOINT_URL", None)

        if value and custom_domain and aws_endpoint_url:
            value = "https://" + value.replace(aws_endpoint_url, custom_domain)

        return value
        ```
Is there any way to use the AWS_S3_CUSTOM_DOMAIN variable in the plugin?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant