Setup
-
Install the wagtail-transfer package with
pip install wagtail-transfer
. -
Add
wagtail_transfer
to your project'sINSTALLED_APPS
. -
In your project's top-level urls.py, add:
from wagtail_transfer import urls as wagtailtransfer_urls
and add:
url(r'^wagtail-transfer/', include(wagtailtransfer_urls)),
to the
urlpatterns
list aboveinclude(wagtail_urls)
. -
Add the settings
WAGTAILTRANSFER_SOURCES
andWAGTAILTRANSFER_SECRET_KEY
to your project settings. These are formatted as:WAGTAILTRANSFER_SOURCES = { 'staging': { 'BASE_URL': 'https://staging.example.com/wagtail-transfer/', 'SECRET_KEY': '4ac4822149691395773b2a8942e1a472', }, 'production': { 'BASE_URL': 'https://www.example.com/wagtail-transfer/', 'SECRET_KEY': 'a36476ffc6af34dc935570d97369eca0', }, } WAGTAILTRANSFER_SECRET_KEY = '7cd5de8229be75e1e0c2af8abc2ada7e'
However, it is best to store the
SECRET_KEY
s themselves in local environment variables for security.WAGTAILTRANSFER_SOURCES
is a dictionary defining the sites available to import from, and their secret keys.WAGTAILTRANSFER_SECRET_KEY
and the per-sourceSECRET_KEY
settings are used to authenticate the communication between the source and destination instances; this prevents unauthorised users from using this API to retrieve sensitive data such as password hashes. TheSECRET_KEY
for each entry inWAGTAILTRANSFER_SOURCES
must match that instance'sWAGTAILTRANSFER_SECRET_KEY
.
Once you've followed these instructions for all your source and destination sites, you can start importing content.
If you need additional configuration - you want to configure which referenced models are updated, how models are identified between Wagtail instances, or which models are pulled in and imported from references on an imported page, you can check out how mappings and references work and the settings reference.