Skip to content

chore(deps): upgrade Django 4.2 LTS -> 5.2 LTS - #2768

Merged
vpetersson merged 1 commit into
masterfrom
chore/django-5.2-upgrade
Apr 29, 2026
Merged

chore(deps): upgrade Django 4.2 LTS -> 5.2 LTS#2768
vpetersson merged 1 commit into
masterfrom
chore/django-5.2-upgrade

Conversation

@vpetersson

Copy link
Copy Markdown
Contributor

Issues Fixed

Django 4.2 LTS is reaching extended-support EOL. Bumping to the next LTS (5.2, supported until April 2028) before 4.2 stops receiving security fixes.

Description

Django 4.2.30 → 5.2.13 plus the dep bumps required to stay on declared-supported versions.

Dependency bumps

  • Django 4.2.30 → 5.2.13
  • django-dbbackup 4.2.1 → 5.3.0 (latest; declares 5.2 support, requires django>=5.0)

All other Django-touching deps (DRF 3.16.1, channels 4.3.1, drf-spectacular 0.29.0, whitenoise 6.8.2, django-stubs 6.0.3) already declare 5.2 support, so no other bumps.

Code changes for 5.x compat

  • Drop USE_L10N (removed in Django 5.0 — localization is now always on)
  • Refresh stale docs.djangoproject.com/en/3.2/ and /en/4.2/ doc URLs to /en/5.2/

Audit findings
The codebase doesn't touch any of the APIs Django 5.0/5.1/5.2 removed: no index_together, no force_text/smart_text, no make_random_password, no DEFAULT_FILE_STORAGE/STATICFILES_STORAGE, no get_storage_class, no LogoutView GET, no PickleSerializer, no length_is. The pytz dep is independent of Django's tz layer (used only to validate /etc/timezone), so it stays.

Verified locally

  • uv lock resolves cleanly (only the two intended bumps)
  • ruff check clean
  • manage.py check clean — no system warnings
  • manage.py makemigrations --check --dry-run — no schema drift
  • 105 non-integration tests pass
  • 12 integration tests pass (5 skipped, same as baseline)

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

Django 4.2 LTS is reaching extended support EOL. Bump to 5.2 LTS
(supported until April 2028) before 4.2 stops receiving security
fixes.

Bumps:
- Django 4.2.30 -> 5.2.13
- django-dbbackup 4.2.1 -> 5.3.0 (latest declares 5.2 support and
  requires django>=5.0)

Code changes for 5.x compat:
- Drop USE_L10N (removed in Django 5.0; localization is now always on)
- Refresh stale doc URLs (en/3.2/, en/4.2/ -> en/5.2/)

Verified no removed-API usage in the codebase: no index_together,
force_text/smart_text, make_random_password, DEFAULT_FILE_STORAGE,
STATICFILES_STORAGE, get_storage_class, LogoutView GET, PickleSerializer,
or pytz-via-Django-tz patterns. The pytz dep is independent (used to
validate /etc/timezone) and stays.

All other deps (DRF 3.16.1, channels 4.3.1, drf-spectacular 0.29.0,
whitenoise 6.8.2, django-stubs 6.0.3) already declare 5.2 support, so
no other version bumps were needed.

Validated:
- uv lock resolves cleanly
- ruff check clean
- manage.py check clean
- manage.py makemigrations --check --dry-run reports no schema drift
- 105 non-integration tests pass
- 12 integration tests pass (5 skipped, same as baseline)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@vpetersson vpetersson self-assigned this Apr 29, 2026
@sonarqubecloud

Copy link
Copy Markdown

@vpetersson
vpetersson marked this pull request as ready for review April 29, 2026 05:52
@vpetersson
vpetersson requested a review from a team as a code owner April 29, 2026 05:52
@vpetersson
vpetersson merged commit 744078b into master Apr 29, 2026
10 checks passed
vpetersson added a commit that referenced this pull request May 1, 2026
* fix(server): migrate dbbackup config to Django 5 STORAGES dict

django-dbbackup v5.0 (pinned in #2768 alongside the Django 5 LTS
upgrade) raises RuntimeError on import if the legacy
DBBACKUP_STORAGE / DBBACKUP_STORAGE_OPTIONS settings are present:

    File ".../dbbackup/settings.py", line 13, in <module>
        raise RuntimeError(msg)
    RuntimeError: The settings DBBACKUP_STORAGE and
    DBBACKUP_STORAGE_OPTIONS have been deprecated in favor of using
    Django Storages configuration.

This blocks every manage.py invocation (most visibly migrate during
container start), since the dbbackup management commands import the
package at registration time.

Move the backup storage config into Django 5's STORAGES dict under
the 'dbbackup' key. Defining STORAGES replaces the framework defaults
entirely, so 'default' and 'staticfiles' are restated even though
they match the global default — without them, file uploads and
WhiteNoise-served staticfiles would lose their backends.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(server): look up upstream branch via direct endpoint

remote_branch_available() listed all branches via GET /branches and
scanned for a name match, but that endpoint paginates at 30 results
and returns them alphabetically. Once auto-generated branches
(claude/*, dependabot/*, renovate/*) pushed past 30, master fell off
the first page, the listing scan returned False, and every
fetch_remote_hash() call logged "Remote Git branch not available"
followed by is_up_to_date()'s "Unable to get latest version from
GitHub". The Anthias repo currently has 81 branches.

Switch to the per-branch endpoint
GET /repos/screenly/anthias/branches/{branch}, which returns 200 if
the branch exists and 404 if not, with no pagination. 404 is treated
as a clean negative ("missing") and cached without triggering the
generic error backoff. Other non-200 responses still go through
handle_github_error().

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant