Skip to content

Commit 1735b60

Browse files
authored
Merge branch 'storage-django-5' of 'https://github.com/jjmerchante/grimoirelab-sortinghat'
Merges #1004 Closes #1004
2 parents 1973829 + 2eb7bfe commit 1735b60

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Django static files configuration
3+
category: fixed
4+
author: Jose Javier Merchante <[email protected]>
5+
issue: null
6+
notes: >
7+
Update the Django STORAGES setting for static files, ensuring
8+
compatibility with Django 5.2.

sortinghat/config/settings.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# Please check the next links for details about the configuration
1010
# in a production environment:
1111
#
12-
# https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
13-
# https://docs.djangoproject.com/en/3.1/ref/settings/
12+
# https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
13+
# https://docs.djangoproject.com/en/5.2/ref/settings/
1414
#
1515
import json
1616
import os
@@ -28,7 +28,7 @@
2828
#
2929
# You must never enable debug in production.
3030
#
31-
# https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-DEBUG
31+
# https://docs.djangoproject.com/en/5.2/ref/settings/#std:setting-DEBUG
3232
#
3333

3434
DEBUG = os.environ.get('SORTINGHAT_DEBUG', 'False').lower() in ('true', '1')
@@ -38,7 +38,7 @@
3838
# If DEBUG is set to False, you will need to configure this parameter,
3939
# with the host you are using to serve SortingHat.
4040
#
41-
# https://docs.djangoproject.com/en/3.1/ref/settings/#allowed-hosts
41+
# https://docs.djangoproject.com/en/5.2/ref/settings/#allowed-hosts
4242
#
4343

4444
if 'SORTINGHAT_ALLOWED_HOST' in os.environ:
@@ -52,7 +52,7 @@
5252
#
5353
# The secret key must be a large random value and it must be kept secret.
5454
#
55-
# https://docs.djangoproject.com/en/3.1/ref/settings/#secret-key
55+
# https://docs.djangoproject.com/en/5.2/ref/settings/#secret-key
5656
#
5757

5858
SECRET_KEY = os.environ['SORTINGHAT_SECRET_KEY']
@@ -130,7 +130,7 @@
130130
#
131131
# Password validation
132132
#
133-
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
133+
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
134134
#
135135

136136
AUTH_PASSWORD_VALIDATORS = [
@@ -172,7 +172,7 @@
172172
#
173173
# Static files (CSS, JavaScript, Images)
174174
#
175-
# https://docs.djangoproject.com/en/4.2/howto/static-files/
175+
# https://docs.djangoproject.com/en/5.2/howto/static-files/
176176
#
177177

178178
STATIC_URL = '/'
@@ -181,8 +181,12 @@
181181
# Current supported cloud platforms are: GCP
182182
if 'SORTINGHAT_STATICFILES_STORAGE' in os.environ:
183183
if os.environ['SORTINGHAT_STATICFILES_STORAGE'].lower() == 'gcp':
184-
STATICFILES_STORAGE = 'storages.backends.gcloud.GoogleCloudStorage'
185-
GS_BUCKET_NAME = os.environ['SORTINGHAT_BUCKET_NAME']
184+
STORAGES = {
185+
"staticfiles": {
186+
"BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
187+
"OPTIONS": {"bucket_name": os.environ["SORTINGHAT_BUCKET_NAME"]},
188+
}
189+
}
186190
else:
187191
raise ValueError(f"'{os.environ['SORTINGHAT_STATICFILES_STORAGE']}' storage is not supported")
188192

@@ -201,7 +205,7 @@
201205
#
202206
# Internationalization
203207
#
204-
# https://docs.djangoproject.com/en/3.1/topics/i18n/
208+
# https://docs.djangoproject.com/en/5.2/topics/i18n/
205209
#
206210
#
207211

@@ -218,7 +222,7 @@
218222
#
219223
# SortingHat Logging
220224
#
221-
# https://docs.djangoproject.com/en/3.1/topics/logging/#configuring-logging
225+
# https://docs.djangoproject.com/en/5.2/topics/logging/#configuring-logging
222226
#
223227

224228
LOGGING = {
@@ -370,7 +374,7 @@
370374
#
371375
# Path of the permission groups configuration file
372376
#
373-
# https://docs.djangoproject.com/en/5.0/topics/auth/default/#groups
377+
# https://docs.djangoproject.com/en/5.2/topics/auth/default/#groups
374378
#
375379

376380
PERMISSION_GROUPS_LIST_PATH = os.environ.get('SORTINGHAT_PERMISSION_GROUPS_LIST_PATH',
@@ -386,7 +390,7 @@
386390
#
387391
# Session cookies configuration
388392
#
389-
# https://docs.djangoproject.com/en/4.2/topics/http/sessions/#settings
393+
# https://docs.djangoproject.com/en/5.2/topics/http/sessions/#settings
390394
#
391395

392396
SESSION_COOKIE_AGE = 1800

0 commit comments

Comments
 (0)