Skip to content

Commit

Permalink
Bump django from 5.0.8 to 5.1.1 (#1225)
Browse files Browse the repository at this point in the history
* Bump django from 5.0.8 to 5.1.1

Bumps [django](https://github.com/django/django) from 5.0.8 to 5.1.1.
- [Commits](django/django@5.0.8...5.1.1)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Set `STORAGES` config

* Fix `staticfiles` of `STORAGES`

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: iamacook <[email protected]>
Co-authored-by: Hector Gómez Varela <[email protected]>
  • Loading branch information
3 people authored Oct 8, 2024
1 parent 74b5079 commit 0c9b958
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
boto3==1.35.34
Django==5.0.8
Django==5.1.1
django-cors-headers==4.4.0
djangorestframework==3.15.2
djangorestframework-camel-case==1.4.2
Expand Down
3 changes: 2 additions & 1 deletion src/chains/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

def _validate_storage_setup() -> None:
if (
settings.DEFAULT_FILE_STORAGE == "storages.backends.s3boto3.S3Boto3Storage"
settings.STORAGES["default"]["BACKEND"]
== "storages.backends.s3boto3.S3Boto3Storage"
and settings.AWS_ACCESS_KEY_ID is None
and settings.AWS_SECRET_ACCESS_KEY is None
and settings.AWS_STORAGE_BUCKET_NAME is None
Expand Down
9 changes: 8 additions & 1 deletion src/chains/tests/test_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
# https://stackoverflow.com/questions/31148172/django-override-setting-used-in-appconfig-ready-function
# https://code.djangoproject.com/ticket/22002
def test_validate_storage_setup(settings) -> None: # type: ignore[no-untyped-def]
settings.DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
settings.STORAGES = {
"default": {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
},
"staticfiles": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
}
settings.AWS_ACCESS_KEY_ID = None
settings.AWS_SECRET_ACCESS_KEY = None
settings.AWS_STORAGE_BUCKET_NAME = None
Expand Down
17 changes: 14 additions & 3 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,20 @@
# Setting AWS_QUERYSTRING_AUTH to False to remove query parameter authentication from generated URLs.
# This can be useful if your S3 buckets are public.
AWS_QUERYSTRING_AUTH = False
DEFAULT_FILE_STORAGE = os.getenv(
"DEFAULT_FILE_STORAGE", "django.core.files.storage.FileSystemStorage"
)
# In Django 4.2, STORAGES replaced DEFAULT_FILE_STORAGE. It was later removed removed in Django 5.1.
# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#configuration-settings
# https://docs.djangoproject.com/en/5.1/releases/5.1/
STORAGES = {
"default": {
"BACKEND": os.getenv(
"DEFAULT_FILE_STORAGE", "django.core.files.storage.FileSystemStorage"
),
},
"staticfiles": {
# Following is default but must explicitly set if "default" is
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"
},
}

# SECURITY
# https://docs.djangoproject.com/en/4.0/ref/settings/#csrf-trusted-origins
Expand Down

0 comments on commit 0c9b958

Please sign in to comment.