Package: wagtail-bakery
Wagtail-bakeryA set of helpers for baking your Django Wagtail site out as flat files.Wagtail-bakery is built on top ofDjango bakery. Please read theirdocumentationfor 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!LinksIssuesChangelogCoverageFeaturesSingle management command that will build your Wagtail site out as flat filesSupport for multisite,themingandmultilingualsetupSupport fori18n_patternsSupport for generating a static APIReady to use Wagtail Buildable views to build all your (un)published pages at once (no extra code required!)Supported VersionsPython 3.8 - 3.11Django 3.2 - 4.1Wagtail >= 4.1We aim to support the Wagtail versions assupportedby Wagtail (current LTS, current stable).Django/Wagtail combinations assupportedby Wagtail (for the Wagtail versions as defined above).Browser supportWe align our browser support targets with that of Wagtail. Have a look at theofficial documentation.Installationpip install wagtail-bakeryAddbakeryandwagtailbakeryto yourINSTALLED_APPSsetting.INSTALLED_APPS=(# ...'bakery','wagtailbakery',)ConfigurationDefine whether you want to build multiple sites or the default site (see examples for impact on directory output), by default this settings isFalse.BAKERY_MULTISITE=TrueAdd 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 withBuildable views. As Django Wagtail uses only thePagemodel 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'sV2 API configuration guide.UsageBuild the site out as flat files by running thebuildmanagement command.manage.py buildIf you want to check how your static website will look, use thebuildservercommand after you have build your static files once.manage.py buildserverExamplesIn theexamplesdirectory 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 theMakecommand to install all requirements, load fixtures and run the server.As described in the usage section, usemanage.py buildto build out the example as static files.Build output withBAKERY_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 withBAKERY_MULTISITE=False(default):build/index.html
build/about/index.html
build/blog/index.html
build/blog/example/index.html
build/static/TroubleshootingFor issuesplease submit an issueon GitHub.DevelopmentWhich 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.ReleasesCreate a new branch (e.g.release/1.1.3) for the release of the new version.Update the version number insetup.pyfollowingSemantic Versioning.UpdateCHANGELOG.md.On GitHub, create a pull request and squash merge it.On GitHub, if this is a minor release bump (for example1.1.0or1.2.0but not1.1.1,1.2.3), create astable/1.1.xbranch frommain.(Optional) Publish to TestPyPI if you need to verify anything:Create and push a tag following the patternX.Y.Z.devN(for example1.1.3.dev1).Follow the action progress for thePublish to TestPyPIworkflow.Check the result onTestPyPI: wagtail-bakery.Publish to PyPI:Create and push a tag followingPEP 440 – Version Identification Specification(for example1.1.3or1.1.3rc1), except for the.devNsuffix used for testing (seePublish to TestPyPIstep above)Follow the action progress for thePublish to PyPIworkflowCheck the result onPyPI: wagtail-bakeryOn GitHub, create a release and a tag for the new version.CreditsThanks to@mhnbcufor bringing this
idea up initially, andDjango Bakeryfor providing the initial bakery package.Thanks to all thecontributorsfor their help.