Skip to main content

Page export from one Wagtail instance into another

Project description

wagtail-import-export

Page export from one Wagtail instance into another.

A published page and its published descendants can be exported via API or file from a source site and imported into a destination site under an existing page.

The destination site should have the same page models as the source site, with compatible migrations.

Installation

Check out this repo somewhere alongside a Wagtail project. From the root of the repo, run:

pip install -e .

Now add to your project's INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    'wagtailimportexport',
    # ...
]

Add the following to your project's urls.py (note that the include(wagtailimportexport_urls) line must appear above the include(wagtail_urls) line that defines Wagtail's default routes):

from wagtailimportexport import urls as wagtailimportexport_urls

urlpatterns = [
    # ...
    url(r'', include(wagtailimportexport_urls)),
    url(r'', include(wagtail_urls)),
]

You should now see an 'Import / Export' item in the Wagtail admin menu.

Configuration

When importing via the API, only published pages are exported by default. If a descendant page is unpublished it and all its descendants are pruned (even if some of those descendants are themselves published).

It is possible to export all pages under a source page by adding a setting on the source site:

WAGTAILIMPORTEXPORT_EXPORT_UNPUBLISHED = True

This should not be used in a public source site because the API is unauthenticated and would thus expose unpublished content to anyone.

Limitations

If the imported content includes any foreign keys to page models, these will be updated to reflect the new page IDs if the target page is also part of the import, or left unchanged otherwise. If the target page is neither part of the import nor does it already exist on the destination site, this is likely to fail with a database integrity error.

Page references within rich text or StreamField content will not be rewritten to reflect new page IDs.

Imports are processed in tree path order; first the base Page records are imported, followed by the data for specific page subclasses. If a model is imported which includes a foreign key to a specific subclass of Page, and the target page of that foreign key appears in the import but later in tree path order, this will fail with an integrity error (as the relevant record will not have been created at that point).

Non-page data, such as images, documents or snippets, is not included in the import; the user is responsible for ensuring that any objects referenced from imported pages are already present on the destination site (with matching IDs).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail-import-export-0.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

wagtail_import_export-0.1-py2.py3-none-any.whl (11.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wagtail-import-export-0.1.tar.gz.

File metadata

File hashes

Hashes for wagtail-import-export-0.1.tar.gz
Algorithm Hash digest
SHA256 0a8b79675a8856442a6216c174cb453def4f337ef0f6c43405900b45d28d19a6
MD5 9af20f799a4500928145c24a8b21045d
BLAKE2b-256 f30e8107eee9f5e82382b620350c9f5cc45193c3a81b71a757deeb91cfde510f

See more details on using hashes here.

File details

Details for the file wagtail_import_export-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_import_export-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d1db31e2de62f2afd47a41045a5ce7fdf414ae216cebb6a6008cff45f7395f4f
MD5 e0c92d6ab21628bc0752f1eb33e71846
BLAKE2b-256 ce87a28ff78ef06890eca5760a58287cd4aa9a2d7a27b2485aa0b07d58ffd980

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page