Wagtail

Tip

To log into the admin interface for our Wagtail sites, append /cms/ e.g. https://www.hatherleigh.info/cms/

Tip

If the page fails to display (probably a 404 Page Not Found error), then try publishing the page again.

Configuration

  1. Start by creating a home page.

  2. Browse to Settings, Sites and delete the default site.

  3. Create a new site and set the Root page to the home page you created in step 1.

Documents

We use SENDFILE for documents…

settings/production.py:

# https://docs.wagtail.io/en/stable/reference/settings.html#documents
WAGTAILDOCS_SERVE_METHOD = "direct"

Note

Really not sure what to do with WAGTAILDOCS_SERVE_METHOD. I tried to use serve_view with django-sendfile and couldn’t get it to work.

Domain

This is the base URL used by the Wagtail admin site:

# settings/local.py
WAGTAILADMIN_BASE_URL = "http://localhost:8000/"
# settings/production.py
WAGTAILADMIN_BASE_URL = DOMAIN

Home

If your Django project is looking for project.home, then try this:

from django.views.generic import RedirectView

url(
    r"^project/home/redirect/$",
    view=RedirectView.as_view(url="/", permanent=False),
    name="project.home",
),

To get the home page and site menu:

class MenuContext:
    def get_context(self, request):
        context = super().get_context(request)
        context["home_page"] = self.get_root()
        context["site_menu"] = self.get_children().live().in_menu()
        return context

# class ContactPage(MenuContext, Page):
#    ...
#
# class DefaultPage(MenuContext, Page):
#    ...

Editor Guide

A guide to using the Editor is here https://guide.wagtail.org/en-latest/

Tip

You can also access the guide through the CMS navigation bar. Go to Help > Editor Guide