Skip to content

Commit 1815e3f

Browse files
committed
moving pages around envs
Changes Made 1. Removed wagtailimportexport/ — the entire vendored package directory 2. Added wagtail-transfer==0.11 to requirements/base.txt 3. Replaced wagtailimportexport with wagtail_transfer in INSTALLED_APPS (openstax/settings/base.py) 4. Added wagtail-transfer settings to base.py — configurable via env vars: - WAGTAILTRANSFER_SECRET_KEY — this instance's auth key - WAGTAILTRANSFER_SOURCE_NAME / _URL / _KEY — defines the source to pull from 5. Added URL route wagtail-transfer/ in openstax/urls.py (above the catch-all wagtail route) What's Needed Next Per-environment setup: On each environment, set these env vars: # On production — pull from staging WAGTAILTRANSFER_SECRET_KEY=<prod-secret> WAGTAILTRANSFER_SOURCE_NAME=staging WAGTAILTRANSFER_SOURCE_URL=https://staging.openstax.org/wagtail-transfer/ WAGTAILTRANSFER_SOURCE_KEY=<staging-secret> # On staging — the secret key must match what prod uses as SOURCE_KEY WAGTAILTRANSFER_SECRET_KEY=<staging-secret> The SECRET_KEY on the source must match the SOURCE_KEY configured on the destination. Run migrations on each environment: python manage.py migrate wagtail_transfer Permissions: Superusers get access automatically. For other users, create a group with the "Can import pages and snippets from other sites" permission. Usage: In Wagtail admin, there will be a new "Import" option. You browse the source environment's page tree and select what to pull in — no more zip files.
1 parent ca817e7 commit 1815e3f

File tree

20 files changed

+26
-1166
lines changed

20 files changed

+26
-1166
lines changed

openstax/settings/base.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
'oxauth',
250250
'webinars',
251251
'donations',
252-
'wagtailimportexport',
252+
'wagtail_transfer',
253253
'versions',
254254
'oxmenus',
255255
# wagtail
@@ -270,6 +270,27 @@
270270
'wagtail.contrib.settings',
271271
]
272272

273+
####################
274+
# Wagtail Transfer #
275+
####################
276+
277+
WAGTAILTRANSFER_SECRET_KEY = os.getenv('WAGTAILTRANSFER_SECRET_KEY', 'change-me-in-production')
278+
279+
# Configure sources to import content from.
280+
# Each environment should define the sources it can pull from.
281+
# Example: on prod, you might pull from staging; on local, from staging or prod.
282+
# Override in environment-specific settings or via env vars.
283+
WAGTAILTRANSFER_SOURCES = {}
284+
285+
_transfer_source_name = os.getenv('WAGTAILTRANSFER_SOURCE_NAME')
286+
_transfer_source_url = os.getenv('WAGTAILTRANSFER_SOURCE_URL')
287+
_transfer_source_key = os.getenv('WAGTAILTRANSFER_SOURCE_KEY')
288+
if _transfer_source_name and _transfer_source_url and _transfer_source_key:
289+
WAGTAILTRANSFER_SOURCES[_transfer_source_name] = {
290+
'BASE_URL': _transfer_source_url,
291+
'SECRET_KEY': _transfer_source_key,
292+
}
293+
273294
########
274295
# Cron #
275296
########

openstax/urls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from wagtail.admin import urls as wagtailadmin_urls
66
from wagtailautocomplete.urls.admin import urlpatterns as autocomplete_admin_urls
77
from wagtail import urls as wagtail_urls
8+
from wagtail_transfer import urls as wagtailtransfer_urls
89
from wagtail.documents import urls as wagtaildocs_urls
910
from accounts import urls as accounts_urls
1011

@@ -48,6 +49,8 @@
4849
path('apps/cms/api/spike/', include(wagtail_urls)),
4950
path('sitemap.xml', sitemap),
5051

52+
path('wagtail-transfer/', include(wagtailtransfer_urls)),
53+
5154
# For anything not caught by a more specific rule above, hand over to Wagtail's serving mechanism
5255
path('', include(wagtail_urls)),
5356
]

requirements/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ vcrpy==7.0.0
3333
wagtail==7.3.1
3434
wagtail-autocomplete==0.12.0
3535
wagtail-modeladmin==2.2.0
36+
wagtail-transfer==0.11
3637
whitenoise==6.9.0

wagtailimportexport/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

wagtailimportexport/admin_urls.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

wagtailimportexport/apps.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

wagtailimportexport/config.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

wagtailimportexport/exporting.py

Lines changed: 0 additions & 189 deletions
This file was deleted.

wagtailimportexport/forms.py

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)