Upgrade to Django 5.2 and Python 3.12 - #702
Draft
cytadela8-ai wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrade the application from Django 3.2.18 to Django 5.2.17 and pin the
deployment runtime to Python 3.12.
This update follows Django's upgrade guide, the release notes for Django 4.0
through 5.2, and the corresponding deprecation timeline. It replaces APIs and
settings that were removed during those releases and updates Django-integrated
packages to versions that support Django 5.2 and Python 3.12.
Dependency and runtime changes
python:3.12-alpineinstead of the floatingpython:alpineimage. This makes the intended Python migration explicit andprevents a later Alpine image update from changing the Python feature version.
python3-devpackage. The official Python imagealready supplies the matching Python 3.12 headers; Alpine's package currently
installs headers for a different Python feature version.
and
psycopg2-binaryto Python 3.12-compatible releases.crispy-bootstrap4, because Bootstrap 4 templates are no longer bundledwith django-crispy-forms 2.x.
ENVsyntax.Django compatibility changes
STATICFILES_STORAGEsetting with the Django 5STORAGESconfiguration while preserving manifest storage for production static files.
USE_L10Nsetting.django.utils.datetime_safe.datetimein a historical migration withthe standard-library
datetime. The migration only constructs ordinary 2020dates, so the removed compatibility wrapper is not required.
pytz.utcwithdatetime.timezone.utcto useDjango's
zoneinfo-based timezone model.versions require the widget to opt into multiple selection and the field to
validate each uploaded file separately.
FormQuestionhas a primarykey. Django 5.2 now raises a clear error for that invalid state. Existing
questions retain the same answer and option cleanup behavior.
SortableAdminBase, as required by currentdjango-admin-sortable2 when their inlines use
SortableInlineAdminMixin.wwwformsstate migration for Django's current hiddenreverse relation serialization of
related_name='+'.Authentication changes
social-auth-app-django rejects GET requests to begin authentication.
accepts GET requests.
social-login forms render without missing-context warnings.
Test compatibility changes
assertFormError()signatureand validation message.
assertRaisesRegexp()alias withassertRaisesRegex().datetime.timezone.utc.Verification
python -m pip checkpython manage.py makemigrations --check --dry-runpython -W error::DeprecationWarning manage.py test -v 1npm run build-devdocker buildgit diff --checkManual Playwright checks covered:
The test runner still reports the existing environment checks for absent OAuth
and email credentials and unavailable nginx media serving. These are expected in
the local test environment and are not Django deprecation warnings.
The existing frontend dependency tree also reports npm audit findings and
Webpack bundle-size/Browserslist warnings. Frontend dependency modernization is
outside this Django and Python runtime upgrade.
This change is