From 5d2620b6c8db8df8c4fb1844ecef93d384ca370e Mon Sep 17 00:00:00 2001
From: florimondmanca <florimond.manca@gmail.com>
Date: Sat, 30 Jun 2018 13:06:27 +0100
Subject: [PATCH] add warnings in aws conf

---
 aws/conf.py | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/aws/conf.py b/aws/conf.py
index ee406b5..e7bf2e4 100644
--- a/aws/conf.py
+++ b/aws/conf.py
@@ -6,35 +6,33 @@ See:
 """
 
 import os
+import warnings
 
 # Use S3 backends
-
 DEFAULT_FILE_STORAGE = 'aws.backends.MediaBackend'
 
-# Uncomment STATICFILES_STORAGE to store static files on AWS
-# Beware that Heroku automatically calls 'manage.py collectstatic' for
-# each deployment, and this backend does not support checking for pre-existing
-# static files on AWS : all the static files will be uploaded on each
-# deployment.
-# It can be OK to set DISABLE_COLLECTSTATIC on Heroku, but then
-# you'd have to run collectstatic manually on Heroku when necessary.
-# Since static files on the backend should not change a lot, it seems OK
-# to simply use the default file storage for static files.
-
-# STATICFILES_STORAGE = 'aws.backends.StaticBackend'
-
 # Credentials
 AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
 AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
 
 # Name of the storage bucket
 AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME')
+
 # Region of the storage bucket (e.g. eu-west-1)
 AWS_S3_REGION_NAME = os.environ.get('AWS_S3_REGION_NAME')
 
-
-# Do not overwrite files with the same name
-AWS_S3_FILE_OVERWRITE = False
+# Warn if any of the above is not set
+if not AWS_ACCESS_KEY_ID:
+    warnings.warn('AWS_ACCESS_KEY_ID not set')
+if not AWS_SECRET_ACCESS_KEY:
+    warnings.warn('AWS_SECRET_ACCESS_KEY not set')
+if not AWS_STORAGE_BUCKET_NAME:
+    warnings.warn('AWS_STORAGE_BUCKET_NAME not set')
+if not AWS_S3_REGION_NAME:
+    warnings.warn('AWS_S3_REGION_NAME not set')
+
+# Overwrite files with the same name
+AWS_S3_FILE_OVERWRITE = True
 
 # Use the new signature version
 AWS_S3_SIGNATURE_VERSION = 's3v4'
-- 
GitLab