From cc54f613602fe88efb448293eb8a7aa86b3fc511 Mon Sep 17 00:00:00 2001 From: Alejandro MG Date: Wed, 24 Jan 2024 18:08:07 +0100 Subject: [PATCH 1/2] Adds dynamic file storage management. Installs django-storages and boto3 for clevercloud Cellar use. --- icare/settings.py | 7 +++++++ requirements.txt | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/icare/settings.py b/icare/settings.py index f8552abb..ceaa160b 100644 --- a/icare/settings.py +++ b/icare/settings.py @@ -160,6 +160,13 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" # Media and file storage +AWS_ACCESS_KEY_ID = os.getenv("CELLAR_KEY") +AWS_SECRET_ACCESS_KEY = os.getenv("CELLAR_SECRET") +AWS_S3_ENDPOINT_URL = os.getenv("CELLAR_HOST") +AWS_STORAGE_BUCKET_NAME = os.getenv("CELLAR_BUCKET_NAME") +AWS_LOCATION = "media" +AWS_QUERYSTRING_AUTH = False + DEFAULT_FILE_STORAGE = os.getenv("DEFAULT_FILE_STORAGE") MEDIA_ROOT = os.getenv("MEDIA_ROOT", os.path.join(BASE_DIR, "media")) MEDIA_URL = "/media/" diff --git a/requirements.txt b/requirements.txt index 5e424bdf..1ff047de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,12 @@ +aiohttp==3.9.1 +aiosignal==1.3.1 asgiref==3.7.2 astroid==3.0.2 +async-timeout==4.0.3 +attrs==23.1.0 black==23.12.1 +boto3==1.34.26 +botocore==1.34.26 certifi==2023.11.17 cffi==1.16.0 cfgv==3.4.0 @@ -15,22 +21,26 @@ django-ckeditor==6.7.0 django-filter==23.5 django-js-asset==2.2.0 django-simple-history==3.4.0 -django-webpack-loader==3.0.1 +django-storages==1.14.2 +django-webpack-loader==3.0.0 djangorestframework==3.14.0 djangorestframework-camel-case==1.4.2 drf-base64==2.0 factory-boy==3.3.0 -Faker==22.4.0 +Faker==22.2.0 filelock==3.13.1 +frozenlist==1.4.1 identify==2.5.33 idna==3.6 isort==5.13.2 +jmespath==1.0.1 mccabe==0.7.0 +multidict==6.0.4 mypy-extensions==1.0.0 nodeenv==1.8.0 packaging==23.2 pathspec==0.12.1 -Pillow==10.2.0 +pillow==10.2.0 pipdeptree==2.13.2 platformdirs==4.1.0 pre-commit==3.6.0 @@ -45,11 +55,13 @@ pytz==2023.3.post1 PyYAML==6.0.1 requests==2.31.0 requests-mock==1.11.0 +s3transfer==0.10.0 sib-api-v3-sdk==7.6.0 six==1.16.0 sqlparse==0.4.4 tomli==2.0.1 tomlkit==0.12.3 typing_extensions==4.9.0 -urllib3==2.1.0 +urllib3==2.0.7 virtualenv==20.25.0 +yarl==1.9.4 From 5158defa894320148d96e21173e070eb3e986eee Mon Sep 17 00:00:00 2001 From: Alejandro MG Date: Wed, 24 Jan 2024 18:10:08 +0100 Subject: [PATCH 2/2] Moves email settings to their section --- icare/settings.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/icare/settings.py b/icare/settings.py index ceaa160b..75de6bd9 100644 --- a/icare/settings.py +++ b/icare/settings.py @@ -191,6 +191,11 @@ EMAIL_HOST = "localhost" EMAIL_PORT = 1025 +NEWSLETTER_BREVO_LIST_ID = os.getenv("NEWSLETTER_BREVO_LIST_ID") +ANYMAIL = { + "SENDINBLUE_API_KEY": os.getenv("BREVO_API_KEY", ""), +} + # Rest framework REST_FRAMEWORK = { @@ -239,11 +244,6 @@ }, } -NEWSLETTER_BREVO_LIST_ID = os.getenv("NEWSLETTER_BREVO_LIST_ID") -ANYMAIL = { - "SENDINBLUE_API_KEY": os.getenv("BREVO_API_KEY", ""), -} - # CK Editor CKEDITOR_UPLOAD_PATH = "uploads/" CKEDITOR_IMAGE_BACKEND = "pillow"