diff --git a/.env_SAMPLE b/.env_SAMPLE index 8854a5aa069..097033f01b5 100755 --- a/.env_SAMPLE +++ b/.env_SAMPLE @@ -177,7 +177,6 @@ export HUD_API_ENDPOINT=http://localhost:8000/hud-api-replace/ # export OIDC_OP_JWKS_ENDPOINT=[Not used for test OIDC provider] # export OIDC_OP_ADMIN_ROLE=[Not supported by test OIDC provider] - ############################### # Deletion archival storage ############################### diff --git a/cfgov/apache/conf.d/wagtail_deletion.conf.sample b/cfgov/apache/conf.d/wagtail_deletion.conf.sample deleted file mode 100644 index 65d9ab5570e..00000000000 --- a/cfgov/apache/conf.d/wagtail_deletion.conf.sample +++ /dev/null @@ -1,7 +0,0 @@ -# Serve deleted content JSON archives at /__deleted -PassEnv WAGTAIL_DELETION_ARCHIVE_PATH -LoadModule autoindex_module modules/mod_autoindex.so -Alias /__deleted/ "${WAGTAIL_DELETION_ARCHIVE_PATH}" - - Options +Indexes - diff --git a/cfgov/cfgov/settings/base.py b/cfgov/cfgov/settings/base.py index 7843bc41b0d..2ca1290c2e2 100644 --- a/cfgov/cfgov/settings/base.py +++ b/cfgov/cfgov/settings/base.py @@ -271,7 +271,23 @@ "django.contrib.staticfiles.finders.FileSystemFinder", ] -STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage" +STORAGES = { + "default": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + }, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, +} + +if WAGTAIL_DELETION_ARCHIVE_PATH := os.getenv("WAGTAIL_DELETION_ARCHIVE_PATH"): + STORAGES["wagtail_deletion_archival"] = { + "BACKEND": "django.core.files.storage.FileSystemStorage", + "OPTIONS": { + "location": WAGTAIL_DELETION_ARCHIVE_PATH, + } + } + # Add the frontend build output to static files. STATICFILES_DIRS = [ @@ -363,12 +379,15 @@ if os.environ.get("S3_ENABLED", "False") == "True": AWS_ACCESS_KEY_ID = os.environ["AWS_ACCESS_KEY_ID"] AWS_SECRET_ACCESS_KEY = os.environ["AWS_SECRET_ACCESS_KEY"] - DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" AWS_S3_CUSTOM_DOMAIN = os.environ.get("AWS_S3_CUSTOM_DOMAIN") MEDIA_URL = os.path.join( AWS_STORAGE_BUCKET_NAME + ".s3.amazonaws.com", AWS_LOCATION, "" ) + STORAGES["default"] = { + "BACKEND": "storages.backends.s3boto3.S3Boto3Storage", + } + # GovDelivery GOVDELIVERY_ACCOUNT_CODE = os.environ.get("GOVDELIVERY_ACCOUNT_CODE") diff --git a/cfgov/cfgov/settings/production.py b/cfgov/cfgov/settings/production.py index 1dac13b931f..7e35a416405 100644 --- a/cfgov/cfgov/settings/production.py +++ b/cfgov/cfgov/settings/production.py @@ -85,9 +85,9 @@ EMAIL_HOST = os.getenv("EMAIL_HOST") DEFAULT_FROM_EMAIL = "wagtail@cfpb.gov" -STATICFILES_STORAGE = ( - "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" -) +STORAGES["staticfiles"] = { + "BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" +} STATIC_ROOT = os.environ["DJANGO_STATIC_ROOT"] diff --git a/cfgov/cfgov/settings/test.py b/cfgov/cfgov/settings/test.py index d90370e1344..7f6bd3a706f 100644 --- a/cfgov/cfgov/settings/test.py +++ b/cfgov/cfgov/settings/test.py @@ -41,6 +41,9 @@ GOVDELIVERY_API = "core.govdelivery.MockGovDelivery" +# Disable Wagtail deletion archive storage during testing. +STORAGES.pop("wagtail_deletion_archival", None) + STATICFILES_FINDERS += [ "core.testutils.mock_staticfiles.MockStaticfilesFinder", ] diff --git a/cfgov/wagtail_deletion_archival/apps.py b/cfgov/wagtail_deletion_archival/apps.py index b7c5695efc0..75824eaa1d0 100644 --- a/cfgov/wagtail_deletion_archival/apps.py +++ b/cfgov/wagtail_deletion_archival/apps.py @@ -1,15 +1,6 @@ from django.apps import AppConfig -from django.conf import settings - -import fs class WagtailDeletionArchivalConfig(AppConfig): name = "wagtail_deletion_archival" label = "wagtail_deletion_archival" - filesystem_name = getattr( - settings, "WAGTAIL_DELETION_ARCHIVE_FILESYSTEM", None - ) - filesystem = ( - fs.open_fs(filesystem_name) if filesystem_name is not None else None - ) diff --git a/cfgov/wagtail_deletion_archival/templates/wagtail_deletion_archival/import_page.html b/cfgov/wagtail_deletion_archival/templates/wagtail_deletion_archival/import_page.html index 20eb0e903a2..32bd203fb90 100644 --- a/cfgov/wagtail_deletion_archival/templates/wagtail_deletion_archival/import_page.html +++ b/cfgov/wagtail_deletion_archival/templates/wagtail_deletion_archival/import_page.html @@ -1,14 +1,14 @@ {% extends "wagtailadmin/base.html" %} {% load i18n wagtailadmin_tags %} -{% block titletag %}Import page into {{ title }}{% endblock %} +{% block titletag %}Import page into {{ parent_page.get_admin_display_title }}{% endblock %} {% block content %} - {% include "wagtailadmin/shared/header.html" with title="Import page" subtitle=page.get_admin_display_title icon="doc-empty-inverse" %} + {% include "wagtailadmin/shared/header.html" with title="Import page" subtitle=parent_page.get_admin_display_title icon="doc-empty-inverse" %}
{% include "wagtailadmin/shared/non_field_errors.html" %} -
+ {% csrf_token %}