Skip to content

Instantly share code, notes, and snippets.

@gilsondev
Last active December 25, 2015 15:19
Show Gist options
  • Save gilsondev/6996818 to your computer and use it in GitHub Desktop.
Save gilsondev/6996818 to your computer and use it in GitHub Desktop.
Configuração para projetos Django com uso da Amazon S3 usando django-storages
INSTALLED_APPS = (
# Django apps
# Third-party apps
'storages',
# Project apps
)
# Django Storages
DEFAULT_FILE_STORAGE = '<project_name>.s3utils.MediaRootS3BotoStorage'
DEFAULT_FILE_STORAGE = '<project_name>.s3utils.StaticRootS3BotoStorage'
STATICFILES_STORAGE = '<project_name>.s3utils.StaticRootS3BotoStorage'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', '')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', '')
AWS_STORAGE_BUCKET_NAME = '<bucket-name>'
AWS_QUERYSTRING_AUTH = False
AWS_HEADERS = { 'Expires': 'Thu, 15 Apr 2010 20:00:00 GMT', 'Cache-Control': 'max-age=86400', }
MEDIA_URL = 'https://%s.s3.amazonaws.com/static/' % AWS_STORAGE_BUCKET_NAME
STATIC_URL = 'https://%s.s3.amazonaws.com/static/' % AWS_STORAGE_BUCKET_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment