A Wagtail app to check the configuration of Wagtail Sites.
Project description
Wagtail Site Check
A Wagtail app to check the configuration of Wagtail Sites.
Have you ever experienced a failing Wagtail preview? Searching for hours, only to find out a misconfiguration of Wagtail Site objects? Misconfiguration of hostname and port happens often, goes unnoticed for a while, and leads to vague complaints.
When a Wagtail Site is misconfigured, developers like to be notified. This way, the issue can be addressed quickly. To scratch the itch, I created "Wagtail Site Check".
Installation
Install the package with pip:
python -m pip install wagtailsitecheck
Add the app to your INSTALLED_APPS
:
INSTALLED_APPS = [
'wagtailsitecheck',
]
Add ALLOWED_WAGTAIL_SITES
to your settings:
ALLOWED_WAGTAIL_SITES = [
"a.com:443",
"b.com:443",
"c.com:443",
]
When working with multiple environments (DTAP), only specify the allowed wagtail sites for that environment. For example via environment variables.
Usage
The app provides two management commands: checksites
and fixsites
.
It also provides a SiteCheckNotificationPanel
to add a warning to the Wagtail admin dashboard.
Check Sites
The checksites
management command fails hard if an existing Wagtail Site object is not defined in ALLOWED_WAGTAIL_SITES
.
python manage.py checksites
Run this command manually, or add it to your CI/CD pipeline. For example, just after migrate
.
Fix Sites
The fixsites
management command helps to re-configure the sites.
python manage.py fixsites
127.0.0.1:8000 is not in ALLOWED_WAGTAIL_SITES. Specify a number to update the site.
1: a.com:443
2: b.com:443
3: c.com:443
1
Updated 127.0.0.1:8000 -> a.com:443
SiteCheckNotificationPanel
To show a warning on the Wagtail admin dashboard add SiteCheckNotificationPanel
to wagtail_hooks.py
. The warning is only displayed if there are misconfigured sites.
from wagtail import hooks
from wagtailsitecheck.wagtail_hooks import SiteCheckNotificationPanel
@hooks.register('construct_homepage_panels')
def add_site_check_panel(request, panels):
panels.append(SiteCheckNotificationPanel())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wagtail_site_check-0.0.1.tar.gz
.
File metadata
- Download URL: wagtail_site_check-0.0.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9daec4b324354864b66f933df181f0d32adbe44023378f051ccc061b52ada7e3 |
|
MD5 | 0dc014ea30e9c16b145ba0250b5644ab |
|
BLAKE2b-256 | 7ed5e13feb550813d66dedea90505c62db10c71f47e10ee3b53643295ee06c6d |
File details
Details for the file wagtail_site_check-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: wagtail_site_check-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edafe493d1fce29fca2fb82bdcad937e44ccfcd8d5ee6e2bec90f223d54e1157 |
|
MD5 | f349efcae93f8c46264a9e7a2c88c6e0 |
|
BLAKE2b-256 | 76ed15714af0b0ad4c26a010bf8d3927879134f37a0f115d59df2c9dd1091c0f |