From 6f5f1b8576dacdc0c9a6002cd05a1f24babd1e28 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 21 Oct 2024 10:12:29 +0100 Subject: [PATCH] Fix a number of issues with Azure storage (#5476) --- hooks/post_gen_project.py | 6 ++++++ {{cookiecutter.project_slug}}/config/settings/production.py | 4 ++-- {{cookiecutter.project_slug}}/requirements/production.txt | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 9e9af5f2..081e806c 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -91,6 +91,10 @@ def remove_docker_files(): os.remove(os.path.join(".idea", "runConfigurations", file_name)) +def remove_nginx_docker_files(): + shutil.rmtree(os.path.join("compose", "production", "nginx")) + + def remove_utility_files(): shutil.rmtree("utility") @@ -457,6 +461,8 @@ def main(): if "{{ cookiecutter.use_docker }}".lower() == "y": remove_utility_files() + if "{{ cookiecutter.cloud_provider }}".lower() != "none": + remove_nginx_docker_files() else: remove_docker_files() diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 6349e17b..468cc668 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -170,7 +170,7 @@ STORAGES = { "BACKEND": "storages.backends.azure_storage.AzureStorage", "OPTIONS": { "location": "media", - "file_overwrite": False, + "overwrite_files": False, }, }, {%- if cookiecutter.use_whitenoise == 'y' %} @@ -323,7 +323,7 @@ COMPRESS_FILTERS = { "js": ["compressor.filters.jsmin.JSMinFilter"], } {% endif %} -{%- if cookiecutter.use_whitenoise == 'n' -%} +{%- if cookiecutter.use_whitenoise == 'n' and cookiecutter.cloud_provider in ('AWS', 'GCP') -%} # Collectfasta # ------------------------------------------------------------------------------ # https://github.com/jasongi/collectfasta#installation diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 79e66751..b6f22db4 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -4,7 +4,7 @@ gunicorn==23.0.0 # https://github.com/benoitc/gunicorn psycopg[c]==3.2.3 # https://github.com/psycopg/psycopg -{%- if cookiecutter.use_whitenoise == 'n' %} +{%- if cookiecutter.use_whitenoise == 'n'and cookiecutter.cloud_provider in ('AWS', 'GCP') %} Collectfasta==3.2.0 # https://github.com/jasongi/collectfasta {%- endif %} {%- if cookiecutter.use_sentry == "y" %}