Instantly share code, notes, and snippets.

Embed
What would you like to do?
Django settings for S3-based media files
'''
We use S3 as our media backend on Heroku, so set that up
'''
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = "YOUR_AWS_KEY"
AWS_SECRET_ACCESS_KEY = "YOUR_AWS_SECRET"
AWS_STORAGE_BUCKET_NAME = "YOUR_S3_BUCKET_NAME"
'''
Adjust media URL to point directly to S3
'''
MEDIA_URL = 'http://your_s3_bucket_name.s3.amazonaws.com/'
'''
Adjust thumbnail storage
'''
THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment