Last active
August 29, 2015 13:56
-
-
Save a-musing-moose/8793439 to your computer and use it in GitHub Desktop.
S3 static and media storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# S3 config to separate media and static roots | |
from storages.backends.s3boto import S3BotoStorage | |
StaticRootS3BotoStorage = lambda: S3BotoStorage( | |
location='static', | |
secure_urls=False, | |
) | |
MediaRootS3BotoStorage = lambda: S3BotoStorage( | |
location='media', | |
secure_urls=False | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# S3 Storage settings | |
AWS_ACCESS_KEY_ID = 'I have the secret' | |
AWS_SECRET_ACCESS_KEY = 'secrets should be kept that way' | |
AWS_STORAGE_BUCKET_NAME = 'dear-liza' | |
# Django Storages/S3 Settings | |
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' | |
DEFAULT_FILE_STORAGE = 's3utils.MediaRootS3BotoStorage' | |
STATICFILES_STORAGE = 's3utils.StaticRootS3BotoStorage' | |
MEDIA_URL = "https://{}.s3-ap-southeast-2.amazonaws.com/media/".format( | |
AWS_STORAGE_BUCKET_NAME | |
) | |
STATIC_URL = "https://{}.s3-ap-southeast-2.amazonaws.com/static/".format( | |
AWS_STORAGE_BUCKET_NAME | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment