Use Django storage for Wagtail deletion archive #8599
Merged
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.
These code changes propose using Django storage to store and serve the Wagtail deletion archive from #8310, instead of using Apache to serve those files.
This simplifies the configuration and makes it easier to test locally and easier to port in future to other webserver approaches.
With these changes, the deletion archive is now only available behind the Wagtail admin login, at the URL /admin/__deleted/. This URL provides a nicely formatted Wagtail report view where archives can be downloaded (instead of the current PR approach that uses Apache directory serving).
With this change, Django storage configuration has been migrated to
settings.STORAGES
fromsettings.STATICFILES_STORAGE
, which was deprecated in Django 4.2 and removed in Django 5.1.Additionally, with this change, cf.gov deployments that have not defined the
WAGTAIL_DELETION_ARCHIVE_PATH
environment variable still support importing archives; the archive-on-delete and archive download functionality is still disabled in those cases.This commit also includes a minor bugfix to the archive import template which doesn't currently properly display the destination page title.
Screenshots
Notes and todos
TODO: Unit tests! I didn't invest time in making these pending @willbarton review of the general suggestion.
Checklist
/docs
folder) – for basic, close-to-the-code docs on working with this repo