Need custom storage to have two different paths
This commit is contained in:
@ -257,8 +257,8 @@ if os.getenv("VROBBLER_USE_S3", "False").lower() in TRUTHY:
|
||||
location = "/".join([AWS_S3_ENDPOINT_URL, AWS_STORAGE_BUCKET_NAME])
|
||||
print(f"Storing media on S3 at {location}")
|
||||
|
||||
DEFAULT_FILE_storage = "storages.backends.s3boto3.S3Boto3Storage"
|
||||
STATICFILES_STORAGE = "storages.backends.s3boto3.S3StaticStorage"
|
||||
DEFAULT_FILE_storage = "vrobbler.storages.MediaStorage"
|
||||
STATICFILES_STORAGE = "vrobbler.storages.StaticStorage"
|
||||
STATIC_URL = location + "/static/"
|
||||
MEDIA_URL = location + "/media/"
|
||||
|
||||
|
||||
14
vrobbler/storages.py
Normal file
14
vrobbler/storages.py
Normal file
@ -0,0 +1,14 @@
|
||||
import os
|
||||
from storages.backends.s3boto3 import S3Boto3Storage
|
||||
|
||||
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME", "")
|
||||
|
||||
|
||||
class MediaStorage(S3Boto3Storage):
|
||||
bucket_name = AWS_STORAGE_BUCKET_NAME
|
||||
location = "media"
|
||||
|
||||
|
||||
class StaticStorage(S3Boto3Storage):
|
||||
bucket_name = AWS_STORAGE_BUCKET_NAME
|
||||
location = "static"
|
||||
Reference in New Issue
Block a user