Skip to content
Snippets Groups Projects
Commit 5d2620b6 authored by florimondmanca's avatar florimondmanca
Browse files

add warnings in aws conf

parent 06dcf15d
Branches
No related tags found
No related merge requests found
......@@ -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'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment