Princeton-CDH / mep-django

Shakespeare and Company Project - Python/Django web application
https://shakespeareandco.princeton.edu
Apache License 2.0
5 stars 1 forks source link

upgrade to most recent versions of django + wagtail #788

Closed rlskoeser closed 9 months ago

rlskoeser commented 1 year ago

Develop branch has already been partially updated so we're no longer as far behind as we were (this work was tracked on #752), but we should update the code to get it running against the most recent versions of django, wagtail, and python.

Develop is currently on wagtail 2.16, django 3.2, and python 3.9. We'll want to test against newer versions of python and update that as well, but we can't install anything newer than 3.8 until we're migrated to newer PUL VMs (which is in progress).

The wagtail release list includes compatibility with python and django versions: https://docs.wagtail.org/en/stable/releases/upgrading.html

Django has great documentation on how to upgrade: https://docs.djangoproject.com/en/4.2/howto/upgrade-version/

Wagtail 5.0 is not compatible with django 4.1, so upgrade strategy should be as follows:

wagtail 3.0 has an api change that messes up some of our paths, but if you look at the release notes you'll see there's a script included that will make the necessary changes

mep depends on djiffy, so it looks like this upgrade will be blocked until we get that updated first . djiffy depends on piffle and both of them depend on attrmap, which is not being maintained and not available in newer versions of python; they'll both need to be updated to address that dependency. I've already tackled that once with parasolr and was able to get everything working with the addict library instead, so hopefully we can follow the same path.

relevant tasks:

quadrismegistus commented 10 months ago

Ok, we've got the fixture loading problem solved, now working through other failures.

Hunting through one now, keeping notes:

mep/pages/tests/test_pages_models.py::TestHomePage::test_can_create
  /Users/ryanheuser/github/mep-django/venv/lib/python3.8/site-packages/wagtail/query.py:552: RuntimeWarning: Specific versions of the following items could not be found. This is most likely because a database migration has removed the relevant table or record since the item was created:
  [{'id': 2, 'title': 'Shakespeare & Company Project', 'type': <ContentType: wagtaildocs | uploaded document>}]
    warnings.warn(
{
    "model": "wagtailcore.page",
    "pk": 2,
    "fields": {
        "path": "00010001",
        "depth": 2,
        "numchild": 3,
        "translation_key": "304187a7-03ed-43b8-a8a5-8a291d7d7284",
        "locale": 1,
        "latest_revision": null,
        "live": true,
        "has_unpublished_changes": false,
        "first_published_at": null,
        "last_published_at": null,
        "live_revision": null,
        "go_live_at": null,
        "expire_at": null,
        "expired": false,
        "locked": false,
        "locked_at": null,
        "locked_by": null,
        "title": "Shakespeare & Company Project",
        "draft_title": "Shakespeare & Company Project",
        "slug": "home",
        "content_type": 70,
        "url_path": "/home/",
        "owner": null,
        "seo_title": "",
        "show_in_menus": true,
        "search_description": "",
        "latest_revision_created_at": null,
        "alias_of": null
    }
},

I wonder why it's still considered partial? It's created through GET/POST in the test, so I guess it makes sense it's "uploaded"? I already used the migrations to change the fixture json so that it can be loaded. Now I guess it's loading but not sufficiently to avoid UploadedDocument replacing a Document?

jkotin commented 9 months ago

This looks good so far. Anything specific I should test?

rlskoeser commented 9 months ago

@jkotin our automated tests are all passing but they don't cover everything. Things most likely for our tests to miss are the interactive aspects, so beyond just poking around the public and admin portions of the site. maybe you could try editing some page content and making some data changes. If you remember anything that's given us problems in the past, that might be good to check (I know Mary has some standard problem cases she runs through when she does PPA testing, but I'm not sure if we have anything analogous on this project.)

jkotin commented 9 months ago

It looks good to me! I made some new pages, and created some new members. Everything worked well.