Skip to main content

Build Status Updates Code style: black

Python Versions Django Versions

django-letsmaintain

Django middleware that provides a maintenance countdown warning message.

This middleware searches the cache for the key maintenance_alert. Its contents are expected to be a string representing an aware datetime in isoformat:

from datetime import datetime, timezone

the_time = datetime.now(timezone.utc).isoformat(timespec='minutes')
print(the_time)

Example result: '2020-06-24T12:00+00:00'

  • The middleware will raise a warning in all pages with a seconds countdown.

  • The last 60 seconds, the warning message will become an error message.

A bash script can invoke the relevant cache key:

#!/bin/bash

FIVE_MINUTES_LATER=$(date --date "$(date +%Y-%m-%dT%H:%M:%S%:z) +5 min" --iso-8601=minutes)
echo "from django.core.cache import cache; cache.set(\"maintenance_alert\", \"$FIVE_MINUTES_LATER\")" \
  | ./manage.py shell
sleep 5m
# Redirect to maintenance.html
# nginx example: https://lincolnloop.com/blog/pro-tip-redirecting-custom-nginx-maintenance-page/
# <perform maintenance>
# Cancel redirect

Required Settings

The required settings for the middleware to operate are:

  • CACHES
  • TIME_ZONE
  • USE_TZ = True
  • "letsmaintain" in INSTALLED_APPS
  • "letsmaintain.middleware.MaintenanceMiddleware" in MIDDLEWARE after "MessageMiddleware"

Tests

To run the tests:

  • Install tox
  • Define: TOX_DB_NAME, TOX_DB_USER, TOX_DB_PASSWD

Metadata

Release files for django-letsmaintain 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-letsmaintain 1.0.9
File Size Uploaded Provenance Actions
django_letsmaintain-1.0.9.tar.gz 3.8 kB Without provenance Details for django_letsmaintain-1.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-letsmaintain 1.0.9
File Interpreter ABI Platform Actions
django_letsmaintain-1.0.9-py3-none-any.whl Python 3 none any Details for django_letsmaintain-1.0.9-py3-none-any.whl

Total release size: 9.6 kB

Release files / django_letsmaintain-1.0.9.tar.gz

Download URL django_letsmaintain-1.0.9.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
efd51339630d673419286efe5df9a47555835925cfb75a9ea2ba00cbe480a8c1
BLAKE2b-256 checksum
How to use checksums
e048d687939b1c633ec22e916a67b81320a6cf5c023a28066e2a0eb31945eada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.13.7 Linux/6.1.0-39-amd64

Release files / django_letsmaintain-1.0.9-py3-none-any.whl

Download URL django_letsmaintain-1.0.9-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93d39e99ab36885cabce5c4f7d562bdbb8721f9130bcf924a7520dc9c4da7ac5
BLAKE2b-256 checksum
How to use checksums
1a9fed15f78588f4d61f7a8ca4de784474d71ac82ec9a79171cc7279f1c39541
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.13.7 Linux/6.1.0-39-amd64

Security for django-letsmaintain 1.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page