• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Wagtail-bakery

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

License: MIT 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!

Links

Features

  • 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!)

Supported Versions

  • Python 3.8 - 3.11
  • Django 3.2 - 4.2
  • Wagtail >= 4.1

We aim to support the Wagtail versions as supported by Wagtail (current LTS, current stable).

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

Browser support

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

Installation

pip install wagtail-bakery

Add bakery and wagtailbakery to your INSTALLED_APPS setting.

INSTALLED_APPS = (
    # ...
    'bakery',
    'wagtailbakery',
)

Configuration

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.

BAKERY_MULTISITE = True

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).

BAKERY_VIEWS = (
	'wagtailbakery.views.AllPublishedPagesView',
)

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

BAKERY_VIEWS = (
	'wagtailbakery.views.AllPagesView',
)

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

BAKERY_VIEWS = (
	'wagtailbakery.api_views.PagesAPIDetailView',
	'wagtailbakery.api_views.PagesAPIListingView',
	'wagtailbakery.api_views.TypedPagesAPIListingView',
)

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.

Usage

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

manage.py build

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

manage.py buildserver

Examples

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 manage.py build to build out the example as static files.

Build output with BAKERY_MULTISITE=True:

build/example.com/index.html
build/example.com/about/index.html
build/example.com/blog/index.html
build/example.com/blog/example/index.html
build/static/

Build output with BAKERY_MULTISITE=False (default):

build/index.html
build/about/index.html
build/blog/index.html
build/blog/example/index.html
build/static/

Troubleshooting

For issues please submit an issue on GitHub.

Development

Which version combinations to include in Github Actions 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.

Releases

  1. Create a new branch (e.g. release/1.1.3) for the release of the new version.
  2. Update the version number in setup.py following Semantic Versioning.
  3. Update CHANGELOG.md.
  4. On GitHub, create a pull request and squash merge it.
  5. On GitHub, if this is a minor release bump (for example 1.1.0 or 1.2.0 but not 1.1.1, 1.2.3), create a stable/1.1.x branch from main.
  6. (Optional) Publish to TestPyPI if you need to verify anything:
    1. Create and push a tag following the pattern X.Y.Z.devN (for example 1.1.3.dev1).
    2. Follow the action progress for the Publish to TestPyPI workflow.
    3. Check the result on TestPyPI: wagtail-bakery.
  7. Publish to PyPI:
    1. Create and push a tag following PEP 440 – Version Identification Specification (for example 1.1.3 or 1.1.3rc1), except for the .devN suffix used for testing (see Publish to TestPyPI step above)
    2. Follow the action progress for the Publish to PyPI workflow
    3. Check the result on PyPI: wagtail-bakery
  8. On GitHub, create a release and a tag for the new version.

Credits

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.

More Repositories

1

wagtail

A Django content management system focused on flexibility and user experience
Python
17,837
star
2

bakerydemo

Next generation Wagtail demo, born in Reykjavik
Python
963
star
3

django-modelcluster

Django extension to allow working with 'clusters' of models as a single unit, independently of the database
Python
482
star
4

Willow

A wrapper that combines the functionality of multiple Python image libraries into one API
Python
274
star
5

wagtail-localize

Translation plugin for Wagtail CMS
Python
226
star
6

telepath

A library for exchanging data between Python and JavaScript
Python
139
star
7

wagtail-ai

Get help with your Wagtail content using AI superpowers.
Python
136
star
8

wagtail-autocomplete

An Autocomplete edit handler for selecting Pages, Snippets, and more.
Python
119
star
9

wagtail-personalisation

Rule-based personalisation for Wagtail CMS
Python
117
star
10

wagtail-generic-chooser

A toolkit for custom chooser popups in Wagtail
Python
116
star
11

queryish

A library for constructing queries on arbitrary data sources following Django's QuerySet API
Python
106
star
12

wagtailtrans

A Wagtail add-on for supporting multilingual sites
Python
104
star
13

wagtail-factories

Factory boy classes for wagtail
Python
101
star
14

wagtail-transfer

Content transfer for Wagtail
Python
88
star
15

docker-wagtail-develop

Shell
74
star
16

wagtail.org

Wagtail’s official marketing website
Python
66
star
17

rfcs

Wagtail RFCs
45
star
18

wagtail-review

A Wagtail extension for gathering annotations and feedback on pages before publication
Python
43
star
19

wagtail-airtable

Airtable import and export support for Wagtail pages and Django models.
Python
43
star
20

gsoc

Resources, activity, discussions for Wagtail’s participation to Google Summer of Code
Python
39
star
21

wagtail-live

High speed publishing from messaging apps to a Wagtail live blog. A GSoC 2021 project.
Python
37
star
22

nextjs-loves-wagtail

Tutorial: Next.js ❤️ Wagtail
Python
36
star
23

vagrant-wagtail-develop

A script to painlessly set up a Vagrant environment for development of Wagtail
Shell
36
star
24

wagtail-gitpod

Launch a ready-to-code Wagtail development environment with a single click.
30
star
25

guide

A website to teach Wagtail CMS to content editors, moderators and administrators.
Python
30
star
26

sphinx-wagtail-theme

Sphinx theme for Wagtail
SCSS
29
star
27

wagtail-streamfield-migration-toolkit

Python
25
star
28

wagtail-whoosh

Search backend for Wagtail CMS using Whoosh engine.
Python
24
star
29

outreachy

Resources, activity, discussions for Wagtail’s participation to Outreachy
20
star
30

areweheadlessyet

Are we headless yet?
TypeScript
19
star
31

wagtail-vector-index

Store Wagtail pages & Django models as embeddings in vector databases
Python
18
star
32

cookiecutter-wagtail-package

A cookiecutter template for building Wagtail add-on packages
Python
17
star
33

django-permissionedforms

A Django extension for creating forms that vary according to user permissions
Python
12
star
34

roadmap

Wagtail public roadmap
9
star
35

stylelint-config-wagtail

Shareable stylelint config for CSS and SCSS, following Wagtail’s code style.
JavaScript
9
star
36

wagtail-newsletter

Send email newsletters based on Wagtail content
Python
9
star
37

wagtail-multiple-chooser-panel

An InlinePanel variant allowing multiple items to be quickly selected
JavaScript
7
star
38

wagtail-localize-git

Translate Wagtail content using a git repository and PO files
Python
6
star
39

gitpod-wagtail-develop

Dockerfile
6
star
40

eslint-config-wagtail

Shareable ESLint config for Wagtail, based on airbnb/javascript.
JavaScript
6
star
41

wagtail-review-ui

Frontend UI for adding comments on Wagtail pages
TypeScript
4
star
42

wagtail-editable-help

Make help text editable in the Wagtail admin
Python
3
star
43

wagtail-hallo

Wagtail's legacy Hallo.js richtext editor
Python
3
star
44

accessibility

Documentation relating to accessibility efforts in Wagtail
HTML
3
star
45

workshop

2
star
46

how-to-run-a-wagtail-space

Advice for anyone running a community Wagtail event
2
star
47

gsod

Resources, activity, discussions for Wagtail’s participation to Google Season of Docs
2
star
48

telepath-unpack

JavaScript library for unpacking values that have been packed with telepath
JavaScript
2
star
49

your-first-wagtail-site

The solution for Wagtail’s official getting started tutorial
Python
1
star