Skip to main content

A set of helpers for baking your Django Wagtail site out as flat files.

Project description


A set of helpers for baking your Django Wagtail site out as flat files.

Build Status Coverage Status

Wagtail-bakery is built on top of Django bakery. Please read their documentation for detailed configuration and how to build default Django flat files. Yes. Wagtail-bakery is not limited to build Wagtail pages specifically, mixed content is possible!


  • Single management command that will build your Wagtail site out as flat files
  • Support for multisite, theming and multilingual setup
  • Support for i18n_patterns
  • Support for generating a static API
  • Ready to use Wagtail Buildable views to build all your (un)published pages at once (no extra code required!)


pip install wagtail-bakery

Add bakery and wagtailbakery to your INSTALLED_APPS setting.

    # ...


Define whether you want to build multiple sites or the default site (see examples for impact on directory output), by default this settings is False.


Add the build directory where you want to be the site be built as flat files.

BUILD_DIR = '/tmp/build/'

As you may know with Django bakery, the trickiest part is to make your current models/pages buildable with Buildable views. As Django Wagtail uses only the Page model at their lowest level, you can use at least one of the already present Buildable views provided by Wagtail bakery.

Build all published public pages (use for production).


Build all published and unpublished public pages (use for staging/acceptance).


To build static JSON files representing your site's API, use the following views:


The API views use Wagtail's V2 API module. To configure the data that is rendered by these views, please refer to Wagtail's V2 API configuration guide.


Build the site out as flat files by running the build management command. build

If you want to check how your static website will look, use the buildserver command after you have build your static files once. buildserver


In the examples directory you can find a Wagtail setup with fixtures for a single site as well as a multisite setup.

Create a virtualenv and go to one of the examples, you can use the Make command to install all requirements, load fixtures and run the server.

As described in the usage section, use build to build out the example as static files.

Build output with BAKERY_MULTISITE=True:


Build output with BAKERY_MULTISITE=False (default):


Supported Versions

Browser support

We align our browser support targets with that of Wagtail. Have a look at the official documentation.

Python/Django/Wagtail support

Python versions as defined in classifiers.

Wagtail versions as supported by Wagtail (LTS, current and current-1).

Django/Wagtail combinations as supported by Wagtail (for the Wagtail versions as defined above).

Which version combinations to include in Travis test matrix?

In order to keep for CI build time from growing out of control, not all Python/Django/Wagtail combinations will be tested.

Test as follow:

  • All supported Django/Wagtail combinations with the latest supported Python version.
  • The latest supported Django/Wagtail combination for the remaining Python versions.


For issues please submit an issue on GitHub.



  1. Ensure you have the latest versions of pip, setuptools and twine installed in your virtual environment.
  2. Create a new branch (e.g. release/1.1.3) for the release of the new version.
  3. Update the version number in following Semantic Versioning.
  4. Update
  5. On GitHub, create a pull request and squash merge it.
  6. Checkout and pull the master branch locally.
  7. (Optional) If you need to verify anything, use make publish-test to upload to and enter your PyPi test credentials as needed.
  8. Use make publish and enter your PyPi credentials as needed.
  9. On GitHub, create a release and a tag for the new version.


Thanks to @mhnbcu for bringing this idea up initially, and Django Bakery for providing the initial bakery package.

Thanks to all the contributors for their help.

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-bakery-0.5.0.tar.gz (9.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page