Last active
December 20, 2015 04:59
-
-
Save antonagestam/6075199 to your computer and use it in GitHub Desktop.
Django AWS storages
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
# … | |
###### AWS SETTINGS | |
AWS_MEDIA_BUCKET_NAME = AWS_MEDIA_CUSTOM_DOMAIN = 'media.mysite.com' | |
AWS_STATIC_BUCKET_NAME = AWS_STATIC_CUSTOM_DOMAIN = 'static.mysite.com' | |
###### END AWS SETTINGS |
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
from django.conf import settings | |
from storages.backends.s3boto import S3BotoStorage | |
StaticStorage = lambda: S3BotoStorage( | |
bucket=settings.AWS_STATIC_BUCKET_NAME, | |
custom_domain=settings.AWS_STATIC_CUSTOM_DOMAIN) | |
MediaStorage = lambda: S3BotoStorage( | |
bucket=settings.AWS_MEDIA_BUCKET_NAME, | |
custom_domain=settings.AWS_MEDIA_CUSTOM_DOMAIN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment