Update to Django 2
Categories
(Webtools Graveyard :: Pontoon, enhancement, P2)
Tracking
(Not tracked)
People
(Reporter: mathjazz, Assigned: jotes)
References
Details
(Whiteboard: pontoon-django-2)
Attachments
(4 files)
Django 1.11 LTS reaches end of extended support in April 2020:
https://www.djangoproject.com/download/
We should upgrade to Django 2.2 LTS, and afterwards possibly to 3.0.
Note that the on_delete argument for ForeignKey and OneToOneField is now required in models and migrations. We could use the Django update as an opportunity to make deleting user accounts easier by setting on_delete=models.SET_NULL on the User ForeignKeys. See bug 1561663 for more details.
| Reporter | ||
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 1•5 years ago
|
||
As We discussed at All Hands Brrlin, I'll write a small spec to make this migration smooth.
| Reporter | ||
Updated•5 years ago
|
| Assignee | ||
Comment 2•5 years ago
|
||
Hey everyone,
Here's a very short-term plan about the migration to Django 2.2.
I don't know if all of these points can be mapped into separate bugs (?) and how many pull requests this will take.
I'll start with things that shouldn't break the existing code:
- Make all Pontoon's middlewares compatible with Django 2.2
- Update all urls to use simplified routing
- Update the models
- explicitly set
on_deleteattribute on foreign keys and one-to-one fields - check the ordering attribute against https://docs.djangoproject.com/en/3.0/releases/2.2/#model-meta-ordering-will-no-longer-affect-group-by-queries
- explicitly set
- Check if the current dependencies support Django 3 and bump their versions up if needed:
- pytest-django
- django-debug-toolbar
- django-extensions
- django-sslserver
- django-model-utils
- django-ace
- django-allauth
- django-bmemcached
- django-bulk-update
- django-cors-headers
- django_csp
- django-dirtyfields
- django-dotenv
- django_guardian
- django-jinja
- django-nose
- django-notifications-hq
- django-partial-index
- django-pipeline
- django-cookies-samesite
- django-session-csrf
- django-webpack-loader
- graphene-django
After that, We can prepare a PR which will finish the migration:
- Update Pontoon to use Django 2.2
- Set (SESSION|CSRF)_COOKIE_SAMESITE and remove the
django-cookies-samesitefrom the list of the dependencies - Fix unittests if they fail on Django 2.2
- Check the sync (:mathjazz / :adrian, I'll need help with that)
Additional questions:
- :adrian, :mathjazz: Do we want to squash existing migrations?
| Reporter | ||
Comment 3•5 years ago
|
||
Thanks for the update, jotes!
I don't have strong opinions here, so I'll leave the decision about squashing migrations to Adrian.
Comment 4•5 years ago
|
||
You'll need to squash migrations, as Django 2.x will refuse to start if you have old migrations w/out on_delete. So that needs to happen after the change to the models, but before you get off of 1.11.
Clearing NI on Adrian, as there's no choice.
Comment 5•5 years ago
|
||
Comment 6•5 years ago
|
||
Comment 7•5 years ago
|
||
| Reporter | ||
Comment 8•5 years ago
|
||
Once on Django 2/3, we should update django-allauth to the latest version:
https://github.com/mozilla/pontoon/pull/1588#issuecomment-599763118
Comment 9•5 years ago
|
||
Comment 10•5 years ago
|
||
| Reporter | ||
Comment 11•5 years ago
|
||
Let's continue the upgrade process under bug 1627655.
| Reporter | ||
Updated•5 years ago
|
Updated•4 years ago
|
Description
•