Skip to content

Instantly share code, notes, and snippets.

@sid22
Created May 8, 2020 17:43
Show Gist options
  • Save sid22/cbf29a422eda9df1ea2be43d13097fa3 to your computer and use it in GitHub Desktop.
Save sid22/cbf29a422eda9df1ea2be43d13097fa3 to your computer and use it in GitHub Desktop.
if USE_S3:
# aws settings
AWS_S3_OBJECT_PARAMETERS = {
"CacheControl": "max-age=34608000",
}
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY")
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME")
AWS_DEFAULT_ACL = "public-read"
CLOUDFRONT_ID = os.environ.get("CLOUDFRONT_ID")
AWS_S3_CUSTOM_DOMAIN = os.environ.get("CLOUDFRONT_DOMAIN")
# s3 static settings
AWS_LOCATION = "static"
STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{AWS_LOCATION}/"
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
else:
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment