Upgrade to boto3 fixes #998

- Boto3 is the replacement of boto, switch to the latest version
- Switch django-storages class to the one based on Boto3
- AWS_S3_CALLING_FORMAT isn't relevant anymore
This commit is contained in:
Bruno Alla 2017-08-02 20:00:03 +01:00
parent 4e9f18b52d
commit 12db5176d6
2 changed files with 5 additions and 7 deletions

View File

@ -12,7 +12,6 @@ Production Configurations
{% endif %}
"""
from boto.s3.connection import OrdinaryCallingFormat
{% if cookiecutter.use_sentry_for_error_reporting == 'y' %}
import logging
{% endif %}
@ -98,7 +97,6 @@ AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME')
AWS_AUTO_CREATE_BUCKET = True
AWS_QUERYSTRING_AUTH = False
AWS_S3_CALLING_FORMAT = OrdinaryCallingFormat()
# AWS cache settings, don't change unless you know what you're doing:
AWS_EXPIRY = 60 * 60 * 24 * 7
@ -117,9 +115,9 @@ AWS_HEADERS = {
MEDIA_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
{% else %}
# See:http://stackoverflow.com/questions/10390244/
from storages.backends.s3boto import S3BotoStorage
StaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')
MediaRootS3BotoStorage = lambda: S3BotoStorage(location='media')
from storages.backends.s3boto3 import S3Boto3Storage
StaticRootS3BotoStorage = lambda: S3Boto3Storage(location='static')
MediaRootS3BotoStorage = lambda: S3Boto3Storage(location='media')
DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3BotoStorage'
MEDIA_URL = 'https://s3.amazonaws.com/%s/media/' % AWS_STORAGE_BUCKET_NAME
@ -141,7 +139,7 @@ INSTALLED_APPS = ['collectfast', ] + INSTALLED_APPS
{% if cookiecutter.use_compressor == 'y'-%}
# COMPRESSOR
# ------------------------------------------------------------------------------
COMPRESS_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
COMPRESS_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
COMPRESS_URL = STATIC_URL
COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', default=True)
{%- endif %}

View File

@ -16,7 +16,7 @@ gunicorn==19.7.1
# Static and Media Storage
# ------------------------------------------------
boto==2.48.0
boto3==1.4.5
django-storages==1.6.5
{% if cookiecutter.use_whitenoise != 'y' -%}
Collectfast==0.5.2