Skip to content

Commit

Permalink
Merge pull request #908 from ImageMarkup/upgrade-django-storage
Browse files Browse the repository at this point in the history
Upgrade django-storages
  • Loading branch information
danlamanna committed Jun 20, 2024
2 parents 4ace25a + 738d918 commit 6f63ce8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
8 changes: 0 additions & 8 deletions isic/core/storages/s3.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
from datetime import UTC, datetime, timedelta
from urllib.parse import urlencode

from botocore.config import Config
from django.utils.encoding import filepath_to_uri
from storages.backends.s3 import S3Storage
from storages.utils import clean_name


class CacheableCloudFrontStorage(S3Storage):
def __init__(self, **settings):
super().__init__(**settings)

self.config = self.config.merge(
Config(connect_timeout=5, read_timeout=10, retries={"max_attempts": 5})
)

@staticmethod
def next_expiration_time(now=None):
# returns a time > 6 days but <= 7.
Expand Down
3 changes: 3 additions & 0 deletions isic/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import timedelta
from pathlib import Path

from botocore.config import Config
from composed_configuration import (
ComposedConfiguration,
ConfigMixin,
Expand Down Expand Up @@ -244,6 +245,8 @@ class HerokuProductionConfiguration(IsicMixin, HerokuProductionBaseConfiguration

AWS_S3_OBJECT_PARAMETERS = {"ContentDisposition": "attachment"}

AWS_S3_CLIENT_CONFIG = Config(connect_timeout=5, read_timeout=10, retries={"max_attempts": 5})

AWS_S3_FILE_BUFFER_SIZE = 50 * 1024 * 1024 # 50MB

SENTRY_TRACES_SAMPLE_RATE = 0.01 # sample 1% of requests for performance monitoring
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"django-oauth-toolkit<2.0.0",
"django-object-actions",
"django-spurl",
"django-storages==1.14.2",
"django-storages>1.14.2",
"django-widget-tweaks",
"google-analytics-data",
"hashids",
Expand Down

0 comments on commit 6f63ce8

Please sign in to comment.