From 2a2be2f1808baffa41ea16fccfe67c1c07c23a8d Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Mon, 13 Aug 2018 00:06:07 +0200
Subject: [PATCH] Check that AWS vars is set befor using them in
 storage_backends.py.

---
 opentech/storage_backends.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/opentech/storage_backends.py b/opentech/storage_backends.py
index 8dfa86cc6..3039cd5d0 100644
--- a/opentech/storage_backends.py
+++ b/opentech/storage_backends.py
@@ -3,15 +3,19 @@ from storages.backends.s3boto3 import S3Boto3Storage
 
 
 class PublicMediaStorage(S3Boto3Storage):
-    bucket_name = settings.AWS_PUBLIC_BUCKET_NAME
+    if hasattr(settings, 'AWS_PUBLIC_BUCKET_NAME'):
+        bucket_name = settings.AWS_PUBLIC_BUCKET_NAME
+
     file_overwrite = False
     querystring_auth = False
     url_protocol = 'https:'
 
 
 class PrivateMediaStorage(S3Boto3Storage):
+    if hasattr(settings, 'AWS_PRIVATE_BUCKET_NAME'):
+        bucket_name = settings.AWS_PRIVATE_BUCKET_NAME
+
     bucket_acl = 'private'
-    bucket_name = settings.AWS_PRIVATE_BUCKET_NAME
     custom_domain = False
     default_acl = 'private'
     encryption = True
-- 
GitLab