mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-01 19:33:29 +00:00
4fa823e8df
The problem that boto3 closes files has been worked around in django-storages.
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
"""Handles backends for storages"""
|
|
from django.core.files.storage import FileSystemStorage
|
|
from storages.backends.s3 import S3Storage
|
|
from storages.backends.azure_storage import AzureStorage
|
|
|
|
|
|
class StaticStorage(S3Storage): # pylint: disable=abstract-method
|
|
"""Storage class for Static contents"""
|
|
|
|
location = "static"
|
|
default_acl = "public-read"
|
|
|
|
|
|
class ImagesStorage(S3Storage): # pylint: disable=abstract-method
|
|
"""Storage class for Image files"""
|
|
|
|
location = "images"
|
|
default_acl = "public-read"
|
|
file_overwrite = False
|
|
|
|
|
|
class AzureStaticStorage(AzureStorage): # pylint: disable=abstract-method
|
|
"""Storage class for Static contents"""
|
|
|
|
location = "static"
|
|
|
|
|
|
class AzureImagesStorage(AzureStorage): # pylint: disable=abstract-method
|
|
"""Storage class for Image files"""
|
|
|
|
location = "images"
|
|
overwrite_files = False
|
|
|
|
|
|
class ExportsFileStorage(FileSystemStorage): # pylint: disable=abstract-method
|
|
"""Storage class for exports contents with local files"""
|
|
|
|
location = "exports"
|
|
overwrite_files = False
|
|
|
|
|
|
class ExportsS3Storage(S3Storage): # pylint: disable=abstract-method
|
|
"""Storage class for exports contents with S3"""
|
|
|
|
location = "exports"
|
|
default_acl = None
|
|
overwrite_files = False
|