Skip to content

Commit

Permalink
Define storage for static files
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbarbier committed Oct 14, 2024
1 parent fa8e2d5 commit 296631e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
AWS_S3_FILE_OVERWRITE = True
STATIC_ROOT = os.path.join(BASE_DIR, 'collectstatic')
# s3 static settings
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
STATICFILES_STORAGE = 'core.storage_backends.StaticStorage'
STATIC_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/static/'
DEFAULT_FILE_STORAGE = 'core.storage_backends.MediaStorage'
MEDIA_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/media/'
Expand Down
6 changes: 5 additions & 1 deletion src/core/storage_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

class MediaStorage(S3Boto3Storage):
location = 'media'
file_overwrite = False
file_overwrite = True

class StaticStorage(S3Boto3Storage):
location = 'static'
file_overwrite = True

0 comments on commit 296631e

Please sign in to comment.