Fix storage config for azure

This commit is contained in:
Igor 2025-03-20 11:06:17 +01:00
parent 434c3d2c3a
commit 4080d0255a
3 changed files with 12 additions and 9 deletions

View File

@ -168,11 +168,7 @@ STORAGES = {
{%- endif %}
{%- elif cookiecutter.cloud_provider == 'Azure' %}
"default": {
"BACKEND": "storages.backends.azure_storage.AzureStorage",
"OPTIONS": {
"location": "media",
"overwrite_files": False,
},
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.MediaAzureStorage",
},
{%- if cookiecutter.use_whitenoise == 'y' %}
"staticfiles": {
@ -180,10 +176,7 @@ STORAGES = {
},
{%- else %}
"staticfiles": {
"BACKEND": "storages.backends.azure_storage.AzureStorage",
"OPTIONS": {
"location": "static",
},
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.StaticAzureStorage",
},
{%- endif %}
{%- endif %}

View File

@ -0,0 +1,10 @@
from storages.backends.azure_storage import AzureStorage
class StaticAzureStorage(AzureStorage):
location = "static"
class MediaAzureStorage(AzureStorage):
location = "media"
file_overwrite = False