How do I change configuration to upload only media files to S3 and keep static and assets file on the server ?
So far either server all or S3 all, both works but I need to separate them.
All examples I found are all files on S3.
Not claiming that I have any understanding on how static and file storage mechanism works, so help or guidance greatly appreciated.
BASE_DIR = Path(__file__).resolve().parent.parent
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
STATIC_ROOT = os.path.join(BASE_DIR, "assets")
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
FILE_UPLOAD_STORAGE = get_secret('FILE_UPLOAD_STORAGE')
if FILE_UPLOAD_STORAGE == "s3":
# Using django-storages
# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
AWS_S3_ACCESS_KEY_ID = get_secret("AWS_S3_ACCESS_KEY_ID")
AWS_S3_SECRET_ACCESS_KEY = get_secret("AWS_S3_SECRET_ACCESS_KEY")
AWS_STORAGE_BUCKET_NAME = get_secret("AWS_STORAGE_BUCKET_NAME")
AWS_S3_REGION_NAME = get_secret("AWS_S3_REGION_NAME")
AWS_S3_SIGNATURE_VERSION = get_secret("AWS_S3_SIGNATURE_VERSION")