Skip to content

Django 5.2 prep: STORAGES dict + drop USE_L10N (#1081) - #1202

Merged
rdhyee merged 1 commit into
masterfrom
prep/django52-forward-compat
Jul 22, 2026
Merged

Django 5.2 prep: STORAGES dict + drop USE_L10N (#1081)#1202
rdhyee merged 1 commit into
masterfrom
prep/django52-forward-compat

Conversation

@rdhyee

@rdhyee rdhyee commented Jul 3, 2026

Copy link
Copy Markdown
Member

First concrete step toward the Django 4.2 → 5.2 LTS upgrade (#1081). Forward-compatible settings changes that behave identically on the current 4.2 runtime and remove two 5.x landmines.

Changes

  • STORAGES dict replaces DEFAULT_FILE_STORAGE (removed in Django 5.1). STORAGES is supported since 4.2, so this is a no-op on the live runtime; the S3 (django-storages) vs FileSystemStorage selection is preserved.
  • Drop USE_L10N (removed in Django 5.0; localized formatting is always on).

Why it's small

The other landmines from PLAN_django52_upgrade.md are already clean here: no django.utils.timezone.utc, no index_together, no removed util imports (force_text/ugettext/…). The real remaining work is the dependency audit (django-selectable, django-registration, ckeditor5) — separate PRs.

⚠️ Validation needed before merge

The STORAGES change touches the prod S3 media path. Confirm media upload + serve on test.unglue.it before merging (per the plan's "test, don't just rename").

No code reads settings.DEFAULT_FILE_STORAGE directly (checked), and no STATICFILES_STORAGE was set, so static handling is unchanged.

Forward-compatible settings changes that behave identically on the current
Django 4.2 runtime and unblock the 5.2 upgrade:

- Replace DEFAULT_FILE_STORAGE (removed in Django 5.1) with the STORAGES dict.
  STORAGES has been supported since Django 4.2, so this is a no-op on the live
  runtime; the S3 (django-storages) vs FileSystemStorage selection is preserved.
- Remove USE_L10N (removed in Django 5.0; localized formatting is always on).

The other 5.0/5.1 landmines from the plan are already clean in this codebase
(no `django.utils.timezone.utc`, no `index_together`, no removed util imports).

Refs #1081. NOTE: the STORAGES change touches the prod S3 media path — validate
media upload/serve on test.unglue.it before merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fm18PoiZmSo2iJGWHuVNm4
@rdhyee

rdhyee commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

🤖 Codex review: LGTM (no changes). Confirmed: STORAGES is behavior-identical on Django 4.2 (same S3-vs-FileSystem selection, just relocated); explicit staticfiles entry matches Django's default; DEFAULT_FILE_STORAGE removed so no ImproperlyConfigured risk; USE_L10N removal is a no-op (default already True). Reminder: still validate S3 media upload/serve on test.unglue.it before merge.

@rdhyee

rdhyee commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

⚠️ Deploy coordination required (found by Codex during the #1203 spike review): the Ansible-rendered prod.py (provisioning prod.py.j2:175) still sets DEFAULT_FILE_STORAGE after common.py — on Django 4.2 that combination raises ImproperlyConfigured (reproduced locally) → site-wide 500 at boot if this PR deploys alone. Merge+deploy EbookFoundation/regluit-provisioning#61 in the same window (config render before/with app restart).

@rdhyee
rdhyee merged commit 0a66ff5 into master Jul 22, 2026
rdhyee added a commit that referenced this pull request Jul 22, 2026
Release: Django 5.2 prep (#1202) + nh3 XSS sanitization (#1200) to production
@rdhyee rdhyee moved this from In Review to Done in Unglue.it Modernization Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CC+Codex+LGTM Authored by Claude Code and reviewed by Codex; both approved (LGTM). Awaiting human review/merge.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant