diff --git a/backend/core/settings.py b/backend/core/settings.py index ba1eb69..cb43b70 100644 --- a/backend/core/settings.py +++ b/backend/core/settings.py @@ -226,4 +226,27 @@ LOGOUT_REDIRECT_URL = '/' AUTH_USER_MODEL = "users.CustomUser" -ACCOUNT_EMAIL_REQUIRED = True \ No newline at end of file +ACCOUNT_EMAIL_REQUIRED = True + +# Storages + +AWS_ACCESS_KEY_ID = config('AMAZON_S3_ACCESS_KEY') +AWS_SECRET_ACCESS_KEY = config('AMAZON_S3_SECRET_ACCESS_KEY') +AWS_STORAGE_BUCKET_NAME = config('BUCKET_NAME') +AWS_DEFAULT_ACL = 'public-read' +AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com' +AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400'} + +MEDIA_URL = '/mediafiles/' +MEDIA_ROOT = os.path.join(BASE_DIR, 'mediafiles') + +STORAGES = { + "default": { + "BACKEND": "storages.backends.s3.S3Storage", + "OPTIONS": { + }, + }, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e5171c0..2f9a5c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,6 @@ djangorestframework-simplejwt>=5.3 django-cors-headers>=4.3 google_api_python_client>=2.1 google_auth_oauthlib>=1.1 -google-auth-httplib2>=0.1 \ No newline at end of file +google-auth-httplib2>=0.1 +django-storages[s3]>=1.14 +Pillow>=10.1 \ No newline at end of file