From c66d25daa3c71ab8cc8c0127d4009ca2ef0abaa0 Mon Sep 17 00:00:00 2001 From: Lorenz Padberg Date: Thu, 25 May 2023 13:41:57 +0200 Subject: [PATCH] Format with ufmt --- server/backend/custom_azure.py | 11 ++++++----- server/config/settings/base.py | 16 +++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/server/backend/custom_azure.py b/server/backend/custom_azure.py index 910c309e..d84ec148 100644 --- a/server/backend/custom_azure.py +++ b/server/backend/custom_azure.py @@ -1,20 +1,21 @@ - -from storages.backends.azure_storage import AzureStorage from environs import Env +from storages.backends.azure_storage import AzureStorage env = Env() env.read_env() + + class AzureMediaStorage(AzureStorage): if env("IT_USE_AZURE_BLOB_STORAGE", False): account_name = env("IT_AZURE_STORAGE_ACCOUNT") account_key = env("IT_AZURE_STORAGE_KEY") - azure_container = 'media' + azure_container = "media" expiration_secs = None + class AzureStaticStorage(AzureStorage): if env("IT_USE_AZURE_BLOB_STORAGE", False): account_name = env("IT_AZURE_STORAGE_ACCOUNT") account_key = env("IT_AZURE_STORAGE_KEY") - azure_container = 'static' + azure_container = "static" expiration_secs = None - diff --git a/server/config/settings/base.py b/server/config/settings/base.py index 78abed47..d655b3c8 100644 --- a/server/config/settings/base.py +++ b/server/config/settings/base.py @@ -216,16 +216,16 @@ if USE_AWS: DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" elif env("IT_USE_AZURE_BLOB_STORAGE", False): # https://medium.com/@DawlysD/django-using-azure-blob-storage-to-handle-static-media-assets-from-scratch-90cbbc7d56be - DEFAULT_FILE_STORAGE = 'backend.custom_azure.AzureMediaStorage' - #STATICFILES_STORAGE = 'backend.custom_azure.AzureStaticStorage' + DEFAULT_FILE_STORAGE = "backend.custom_azure.AzureMediaStorage" + # STATICFILES_STORAGE = 'backend.custom_azure.AzureStaticStorage' - #STATIC_LOCATION = "static" + # STATIC_LOCATION = "static" MEDIA_LOCATION = "media" AZURE_ACCOUNT_NAME = env("IT_AZURE_STORAGE_ACCOUNT") - AZURE_CUSTOM_DOMAIN = f'{AZURE_ACCOUNT_NAME}.blob.core.windows.net' - #STATIC_URL = f'https://{AZURE_CUSTOM_DOMAIN}/{APP_ENVIRONMENT}/{STATIC_LOCATION}/' - MEDIA_URL = f'https://{AZURE_CUSTOM_DOMAIN}/{APP_ENVIRONMENT}/{MEDIA_LOCATION}/' + AZURE_CUSTOM_DOMAIN = f"{AZURE_ACCOUNT_NAME}.blob.core.windows.net" + # STATIC_URL = f'https://{AZURE_CUSTOM_DOMAIN}/{APP_ENVIRONMENT}/{STATIC_LOCATION}/' + MEDIA_URL = f"https://{AZURE_CUSTOM_DOMAIN}/{APP_ENVIRONMENT}/{MEDIA_LOCATION}/" else: @@ -522,7 +522,9 @@ else: # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts -ALLOWED_HOSTS = env.list("IT_DJANGO_ALLOWED_HOSTS", default=["localhost", "0.0.0.0", "127.0.0.1"]) +ALLOWED_HOSTS = env.list( + "IT_DJANGO_ALLOWED_HOSTS", default=["localhost", "0.0.0.0", "127.0.0.1"] +) # CACHES CACHES = {