Django Filebrowser与storage services不兼容。
在Django Filer上找到的{p> Django Packages似乎是一个不错的选择,但它对存储后端的支持似乎不完整。我想知道Django的文件浏览器的其他替代方案是什么,它与S3很好地集成。
答案 0 :(得分:0)
我在我的项目中使用了https://github.com/bradleyg/django-s3direct。它工作得很好。它也列在你提到的Django Packages网站上。
答案 1 :(得分:0)
当您加入S3BotoStorageMixin
时,此程序包应该能够在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)
和settings.py
:
DEFAULT_FILE_STORAGE = 'myproject.lib.storages.CustomS3BotoStorage'