This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/develop by this push:
new dcbb73f AIRAVATA-2984 default DEBUG to false for Django deploys
dcbb73f is described below
commit dcbb73f518a237121677bc1ae89031c34e20bb4c
Author: Marcus Christie <[email protected]>
AuthorDate: Thu Mar 21 10:52:21 2019 -0400
AIRAVATA-2984 default DEBUG to false for Django deploys
Also add alias for /media serving in Apache virtual host config.
---
dev-tools/ansible/roles/django/defaults/main.yml | 2 ++
dev-tools/ansible/roles/django/tasks/main.yml | 2 ++
dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2 | 8 +++++++-
dev-tools/ansible/roles/django/templates/django-vhost.conf.j2 | 8 +++++++-
dev-tools/ansible/roles/django/templates/settings_local.py.j2 | 3 +--
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/dev-tools/ansible/roles/django/defaults/main.yml
b/dev-tools/ansible/roles/django/defaults/main.yml
index 28b2b2f..edde0cf 100644
--- a/dev-tools/ansible/roles/django/defaults/main.yml
+++ b/dev-tools/ansible/roles/django/defaults/main.yml
@@ -42,6 +42,8 @@ django_settings_local_template: "settings_local.py.j2"
django_wsgi_processes: 2
+django_debug: false
+
## Keycloak related variables
tenant_domain: "{{ gateway_id }}"
oauth_client_key: "RuLl_Uw7i_KXaLoAGJkiasTfyBYa"
diff --git a/dev-tools/ansible/roles/django/tasks/main.yml
b/dev-tools/ansible/roles/django/tasks/main.yml
index f50cf94..03e6fa1 100644
--- a/dev-tools/ansible/roles/django/tasks/main.yml
+++ b/dev-tools/ansible/roles/django/tasks/main.yml
@@ -78,6 +78,8 @@
virtualenv: "{{ django_venv_dir }}"
become: yes
become_user: "{{user}}"
+ notify:
+ - restart uwsgi
- name: Create experiment data dir
file: path="{{ experiment_data_dir }}" state=directory owner="{{user}}"
group="{{group}}" recurse=yes follow=yes
diff --git a/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2
b/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2
index 14e57b7..09d8b09 100644
--- a/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2
+++ b/dev-tools/ansible/roles/django/templates/django-ssl-vhost.conf.j2
@@ -49,6 +49,12 @@
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
text/javascript application/javascript
</Directory>
+ Alias /media/ {{ airavata_django_checkout }}/django_airavata/media/
+
+ <Directory {{ airavata_django_checkout }}/django_airavata/media>
+ Require all granted
+ </Directory>
+
WSGIDaemonProcess {{ vhost_servername }} display-name=%{GROUP}
python-home={{ doc_root_dir }}/venv python-path={{ doc_root_dir
}}/airavata-django-portal processes={{ django_wsgi_processes }} user={{ user }}
group={{ group }}
WSGIProcessGroup {{ vhost_servername }}
@@ -69,4 +75,4 @@
SSLCertificateFile {{ ssl_certificate_file }}
SSLCertificateChainFile {{ ssl_certificate_chain_file }}
SSLCertificateKeyFile {{ ssl_certificate_key_file }}
-</VirtualHost>
\ No newline at end of file
+</VirtualHost>
diff --git a/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2
b/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2
index 767a4ce..995fdde 100644
--- a/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2
+++ b/dev-tools/ansible/roles/django/templates/django-vhost.conf.j2
@@ -40,6 +40,12 @@
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
text/javascript application/javascript
</Directory>
+ Alias /media/ {{ airavata_django_checkout }}/django_airavata/media/
+
+ <Directory {{ airavata_django_checkout }}/django_airavata/media>
+ Require all granted
+ </Directory>
+
WSGIDaemonProcess {{ vhost_servername }} display-name=%{GROUP}
python-home={{ doc_root_dir }}/venv python-path={{ doc_root_dir
}}/airavata-django-portal processes={{ django_wsgi_processes }} user={{ user }}
group={{ group }}
WSGIProcessGroup {{ vhost_servername }}
@@ -53,4 +59,4 @@
ErrorLog {{ httpd_log_dir[ansible_os_family] }}/django-{{ gateway_id
}}.error.log
CustomLog {{ httpd_log_dir[ansible_os_family] }}/django-{{ gateway_id
}}.requests.log combined
-</VirtualHost>
\ No newline at end of file
+</VirtualHost>
diff --git a/dev-tools/ansible/roles/django/templates/settings_local.py.j2
b/dev-tools/ansible/roles/django/templates/settings_local.py.j2
index 371abe7..bcfd076 100644
--- a/dev-tools/ansible/roles/django/templates/settings_local.py.j2
+++ b/dev-tools/ansible/roles/django/templates/settings_local.py.j2
@@ -34,8 +34,7 @@ import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Django - general settings
-# Uncomment and specify for production deployments
-# DEBUG = False
+DEBUG = {{ django_debug | ternary("True", "False") }}
STATIC_ROOT = "{{ doc_root_dir }}/static/"
ALLOWED_HOSTS = ['{{ vhost_servername }}']