From 5ed34e00c99b341c8ab81b1db3659395b3f3e656 Mon Sep 17 00:00:00 2001 From: Stuart MacKay Date: Wed, 27 Jun 2018 13:52:23 +0100 Subject: [PATCH 1/2] Added support for --clear argument to collectstatic. Ansible's django_manage module supports the --clear argument on the collectstatic management command. The feature was added in this PR https://github.com/ansible/ansible-modules-core/pull/1810/ but the documentation was not updated. This PR adds a variable, django_collectstatic_clear that can be used to control whether the --clear argument is used or not. The default value is 'no' to avoid breaking any existing code. --- env_vars/development.yml | 1 + env_vars/vagrant.yml | 1 + roles/web/tasks/setup_django_app.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/env_vars/development.yml b/env_vars/development.yml index 4c35f110..4abfa188 100644 --- a/env_vars/development.yml +++ b/env_vars/development.yml @@ -44,6 +44,7 @@ broker_url: "amqp://{{ rabbitmq_application_user }}:{{ rabbitmq_application_pass run_django_db_migrations: yes run_django_collectstatic: yes +django_collectstatic_clear: no # Nginx settings. diff --git a/env_vars/vagrant.yml b/env_vars/vagrant.yml index d71fa701..1c7ed085 100644 --- a/env_vars/vagrant.yml +++ b/env_vars/vagrant.yml @@ -48,6 +48,7 @@ requirements_file: "{{ project_path }}/requirements_local.txt" run_django_db_migrations: yes run_django_collectstatic: yes +django_collectstatic_clear: no # Nginx settings. diff --git a/roles/web/tasks/setup_django_app.yml b/roles/web/tasks/setup_django_app.yml index 0facfd76..53f658d0 100644 --- a/roles/web/tasks/setup_django_app.yml +++ b/roles/web/tasks/setup_django_app.yml @@ -29,6 +29,7 @@ app_path: "{{ project_path }}" virtualenv: "{{ virtualenv_path }}" settings: "{{ django_settings_file }}" + clear: {{ django_collectstatic_clear }} environment: "{{ django_environment }}" when: run_django_collectstatic is defined and run_django_collectstatic notify: restart application From a51e5a4bd306154d10b7aac570f342cc2f3316f9 Mon Sep 17 00:00:00 2001 From: Stuart MacKay Date: Fri, 29 Jun 2018 18:48:11 +0100 Subject: [PATCH 2/2] Added double-quotesd around variable name. --- roles/web/tasks/setup_django_app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web/tasks/setup_django_app.yml b/roles/web/tasks/setup_django_app.yml index 53f658d0..643f2b65 100644 --- a/roles/web/tasks/setup_django_app.yml +++ b/roles/web/tasks/setup_django_app.yml @@ -29,7 +29,7 @@ app_path: "{{ project_path }}" virtualenv: "{{ virtualenv_path }}" settings: "{{ django_settings_file }}" - clear: {{ django_collectstatic_clear }} + clear: "{{ django_collectstatic_clear }}" environment: "{{ django_environment }}" when: run_django_collectstatic is defined and run_django_collectstatic notify: restart application