[Django]-Django – Alternatives To File Browser that Work Well With S3

0👍

I’ve used https://github.com/bradleyg/django-s3direct in my project. It worked nice. It is also listed on Django Packages site you mentioned.

0👍

When you include the S3BotoStorageMixin, this package should be able to work on S3.

from filebrowser.storage import S3BotoStorageMixin
from storages.backends.s3boto import S3BotoStorage


class CustomS3BotoStorage(S3BotoStorageMixin, S3BotoStorage):
    def path(self, name):
        # Workaround for django-filebrowser, which requests full_path on uploaded files.
        # The operation is not needed at all, since no chmod happens afterwards.
        return self.url(name)

    def isfile(self, name):
        # Hacky performance optimization for filebrowser.
        # The original isdir() method is really inefficient.
        if '.' in name:
            return True
        return super().isfile(name)

and in settings.py:

DEFAULT_FILE_STORAGE = 'myproject.lib.storages.CustomS3BotoStorage'
👤vdboor

Leave a comment