Format with ufmt

This commit is contained in:
Lorenz Padberg 2023-05-25 13:41:57 +02:00 committed by Daniel Egger
parent a6add055f6
commit c66d25daa3
2 changed files with 15 additions and 12 deletions

View File

@ -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

View File

@ -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 = {