Skip to main content

A simple page cache for Wagtail based on the Django cache middleware.

Project description

Wagtail Cache

A simple page cache for Wagtail based on the Django cache middleware.

Documentation | Source code on GitHub


Python Package PyPI - Python Version PyPI - Django Version PyPI - Wheel PyPI - Downloads PyPI
Build Build Status Azure DevOps tests (branch) Azure DevOps coverage (branch)

Quick Start

Follow the Installation Guide

Why Wagtail Cache?

Django has a robust cache middleware that already has the functionality needed to cache web pages effectively. But turning the cache middleware on will blindly cache every request and does not work well with a wagtail site.

Wagtail Cache provides a decorator that works well with wagtail pages to appropriately cache and serve them similar to Django's cache middleware.

The end result is ultra-fast page serving that requires zero database hits to serve cached pages. Other solutions such as template caching still require database hits for wagtail to serve a page.


This cache feature was originally part of coderedcms and has been split out into this separate package. Wagtail Cache is tried and tested, and is in use successfully on many live production sites.


To set up your development environment:

  1. Create a new environment:
python -m venv ~/Envs/wagtail-cache
# Mac and Linux
source ~/Envs/wagtail-cache/bin/activate
# Windows (PowerShell)
  1. Enter the source code directory and install the package locally with additional development tools:
pip install -r requirements-dev.txt
  1. Write some code.

  2. Next, run the static analysis tools (flake8 and mypy)

flake8 ./wagtailcache/
mypy ./wagtailcache/
  1. Next, run the units tests. A simple Wagtail project using Wagtail Cache is in the testproject/ directory. The tests will generate a visual HTML file at htmlcov/index.html when finished, which you can open in your browser.
pytest ./testproject/
  1. To build the documentation, run the following, which will output to the docs/_build/html/ directory.
sphinx-build -M html ./docs/ ./docs/_build/ -W
  1. To create a python package, run the following, which will output the package to the dist/ directory.
python sdist bdist_wheel

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wagtail-cache, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size wagtail_cache-1.0.1-py3-none-any.whl (11.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size wagtail-cache-1.0.1.tar.gz (9.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page