Skip to content

Commit bfc5722

Browse files
committed
chore: use Django 5.2 STORAGES
Depriciate STATICFILES_STORAGE and DEFAULT_FILE_STORAGE, and use STORAGE in Django 5.2
1 parent 8b65fac commit bfc5722

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

credentials/settings/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,10 @@
456456
FILE_STORAGE_BACKEND = {}
457457
EXTRA_APPS = []
458458
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
459-
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
459+
STORAGES = {
460+
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
461+
"staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"},
462+
}
460463
CACHES = {
461464
"default": {
462465
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
@@ -474,7 +477,7 @@
474477
}
475478
API_ROOT = None
476479
MEDIA_STORAGE_BACKEND = {
477-
"DEFAULT_FILE_STORAGE": "django.core.files.storage.FileSystemStorage",
480+
"DEFAULT_FILE_STORAGE": STORAGES["default"]["BACKEND"],
478481
"MEDIA_ROOT": MEDIA_ROOT,
479482
"MEDIA_URL": MEDIA_URL,
480483
}

credentials/settings/devstack.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@
4343
EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
4444
EMAIL_FILE_PATH = "/tmp/credentials-emails"
4545

46-
DEFAULT_FILE_STORAGE = os.environ.get("DEFAULT_FILE_STORAGE", "django.core.files.storage.FileSystemStorage")
46+
STORAGES["default"]["BACKEND"] = os.environ.get(
47+
STORAGES["default"]["BACKEND"], "django.core.files.storage.FileSystemStorage"
48+
)
4749
MEDIA_URL = os.environ.get("MEDIA_URL", "/media/")
4850

49-
STATICFILES_STORAGE = os.environ.get("STATICFILES_STORAGE", "django.contrib.staticfiles.storage.StaticFilesStorage")
51+
STORAGES["staticfiles"]["BACKEND"] = "django.contrib.staticfiles.storage.StaticFilesStorage"
5052
STATIC_URL = os.environ.get("STATIC_URL", "/static/")
5153

5254
# OAuth2 variables specific to social-auth/SSO login use case.

credentials/settings/test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535

3636
# Local Directories
3737
TEST_ROOT = path("test_root")
38-
DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage"
38+
STORAGES["default"]["BACKEND"] = os.environ.get(
39+
STORAGES["default"]["BACKEND"], "django.core.files.storage.FileSystemStorage"
40+
)
3941
MEDIA_ROOT = str(TEST_ROOT / "uploads")
4042
MEDIA_URL = "/static/uploads/"
4143

@@ -49,7 +51,7 @@
4951
"JWT_AUDIENCE": SOCIAL_AUTH_EDX_OAUTH2_KEY,
5052
}
5153
)
52-
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
54+
STORAGES["staticfiles"]["BACKEND"] = "django.contrib.staticfiles.storage.StaticFilesStorage"
5355

5456
# Verifiable Credentials
5557
ENABLE_VERIFIABLE_CREDENTIALS = True

0 commit comments

Comments
 (0)