Setup
-
Install the wagtail-transfer package with
pip install wagtail-transfer. -
Add
wagtail_transferto 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
urlpatternslist aboveinclude(wagtail_urls). -
Add the settings
WAGTAILTRANSFER_SOURCESandWAGTAILTRANSFER_SECRET_KEYto 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_KEYs themselves in local environment variables for security.WAGTAILTRANSFER_SOURCESis a dictionary defining the sites available to import from, and their secret keys.WAGTAILTRANSFER_SECRET_KEYand the per-sourceSECRET_KEYsettings 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_KEYfor each entry inWAGTAILTRANSFER_SOURCESmust 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.