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

Status

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.

Notes

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.

Contributing

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)
~/Envs/wagtail-cache/Scripts/Activate.ps1
  1. Enter the source code directory and install the package locally with additional development tools:
pip install -e ./[dev]
  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 setup.py 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.

Source Distribution

wagtail-cache-1.0.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtail_cache-1.0.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file wagtail-cache-1.0.0.tar.gz.

File metadata

  • Download URL: wagtail-cache-1.0.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for wagtail-cache-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aae065e5f2228da5fdee89672df0ef4dde0f733a60036caed72db2bb018ea554
MD5 365e65d8235ad3d1417cd740c75879bb
BLAKE2b-256 a11ad40aae10483e60d81b85aa9dd53ab3b99f465ce10cbb67dc8ec65801f334

See more details on using hashes here.

File details

Details for the file wagtail_cache-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: wagtail_cache-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for wagtail_cache-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c585af2aa402444fd80c35de6ed4b529248e0b506652fec23daca6602d27653
MD5 6c69e31188f50c247eda8f32715dc609
BLAKE2b-256 95ae848b0a821efec35c3fe7fba4e4121bf293fe29c470dd4574de0e8493e6e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page