Skip to content

Django: upgrade to 4.2 #10595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 8, 2023
Merged

Django: upgrade to 4.2 #10595

merged 14 commits into from
Aug 8, 2023

Conversation

humitos
Copy link
Member

@humitos humitos commented Aug 2, 2023

Run django-upgrade (https://github.com/adamchainz/django-upgrade) to automatically upgrade our code to match 4.2.

I made each commit to be valuable for review. Note the first commit contains all the auto-changes from django-upgrade. So, that's probably a good one to skip.

Important notes from the release notes

I read all the release notes and wrote down the ones that I found important (e.g. affect our application) here as a summary.

Django 4.0

https://docs.djangoproject.com/en/4.2/releases/4.0/

Django 4.1

https://docs.djangoproject.com/en/4.2/releases/4.1/

  • We can now use SECRET_KEY_FALLBACKS to rotate our key as we wanted

Django 4.2

https://docs.djangoproject.com/en/4.2/releases/4.2/

Related:

@humitos humitos requested a review from a team as a code owner August 2, 2023 10:57
@humitos humitos requested a review from stsewd August 2, 2023 10:57
@humitos humitos requested a review from ericholscher August 2, 2023 10:57
@humitos
Copy link
Member Author

humitos commented Aug 2, 2023

I pushed a new commit that fixes a bunch of tests, but there are still 11 that are failing. Some of them are related to privacy levels that I wasn't able to fix 🤷🏼

Besides, tests using fake_paths_by_regex are failing when checking os.path.exists.

This is pretty close. I'm pinging @stsewd here in case he knows what I'm missing at this point.

@humitos
Copy link
Member Author

humitos commented Aug 6, 2023

All tests are passing ✨ 🍰 !

@stsewd @ericholscher I'd really appreciate an approve here so we can move forward with this and test it in production. It seems we don't have a ton of things to deploy this Tuesday, so it may be a good opportunity to do a deploy without many other changes together.

Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty straightforward with the test header refactor, re_path removal, and admin changes. I had a couple questions, but overall seems like it shouldn't impact much.

@@ -1,6 +1,6 @@
"""URL configuration for builds app."""

from django.conf.urls import re_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of this PR seems to remove re_path, but this just changes the import?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. re_path was moved around and it's now under a different import path.

The usage of re_path here cannot be changed by path directly because we have non-simple/standard regex that django-upgrade can detect and adapt to just path. That's my bet, tho.

humitos added a commit that referenced this pull request Aug 8, 2023
This setting was required during the Django 4.2 migration only and it can be
removed now.

Related: #10595
@humitos
Copy link
Member Author

humitos commented Aug 8, 2023

I did some QA yesterday by spinning up some instances in production and routing some traffic to them. I was able to fix some obvious issues and after that the instances were healthy. I'll merge all these Django upgrade PRs so we can start testing them more locally before deploying them.

@humitos humitos merged commit df31c79 into main Aug 8, 2023
@humitos humitos deleted the humitos/django-4-2 branch August 8, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants