Skip to main content

django-loknotify

A reusable Django notification framework. Your app decides which events exist, which providers can deliver them (Discord and Mailgun are bundled; add your own), who may send, and how messages look. Administrators then connect channels, write rules for when they fire, preview the message, and send tests, all inside the limits the host app sets.

  • Provider-agnostic: a small Provider class is all a new channel (Slack, Teams, SMS, ...) needs.
  • Domain-agnostic: no built-in business events. You register your own with register_event.
  • Layered configuration: defaults, settings and environment variables, an optional host config source, then the admin database. Admins can only narrow or tune inside the host ceiling, and the host can lock any setting.
  • Optional multi-user mode: non-admin users manage their own channels and preferences under a host policy. It is off by default.
  • Safe by default: encrypted channel secrets, SSRF guards, mention and header-injection protection, redacted logs, rate limits, retry with backoff, and automatic channel disabling.
  • Interfaces: DRF API, generated Django admin screens, and management commands.

Install

pip install django-loknotify            # add [celery] for the Celery dispatcher
# settings.py
INSTALLED_APPS = [..., "rest_framework", "loknotify"]

# urls.py
path("api/", include("loknotify.urls")),
python manage.py migrate
python manage.py check

Quick start

Register an event (anywhere that loads at startup, or in a loknotify_events.py module in any installed app):

from loknotify import register_event

register_event(
    "order.paid",
    label="Order paid",
    context={"order_id": "string", "total": "float"},
    filterable=["total"],
    sample_context={"order_id": "A-1001", "total": 49.5},
    default_templates={"discord": {"embed_title": "Order {{ order_id }} paid"}},
)

Emit it from your code:

from loknotify import emit

emit("order.paid", application="my-shop", context={"order_id": "A-1001", "total": 49.5})

In the Django admin, add a channel (for example a Discord webhook), add a rule for order.paid, preview it, and send a test. See example/ for a runnable host project and docs/GUIDE.md for everything else.

Documentation

  • docs/README.md: concepts and how a notification travels from emit() to the provider.
  • docs/GUIDE.md: configuration reference, providers, formatting, multi-user mode, API, commands, deployment, and "Writing a provider".

Development

py -3.13 -m venv .venv
.venv\Scripts\python -m pip install -e ".[dev]"
.venv\Scripts\python -m pytest loknotify/tests -q
.venv\Scripts\python -m black loknotify example && .venv\Scripts\python -m flake8 loknotify example
.venv\Scripts\python -m mypy
.venv\Scripts\python manage.py check          # runs the example project in example/

License: GPL-3.0-or-later.

Metadata

Release files for django-loknotify 0.1.0

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-loknotify 0.1.0
File Size Uploaded Provenance Actions
django_loknotify-0.1.0.tar.gz 92.9 kB Without provenance Details for django_loknotify-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-loknotify 0.1.0
File Interpreter ABI Platform Actions
django_loknotify-0.1.0-py3-none-any.whl Python 3 none any Details for django_loknotify-0.1.0-py3-none-any.whl

Total release size: 207.3 kB

Release files / django_loknotify-0.1.0.tar.gz

Download URL django_loknotify-0.1.0.tar.gz
Size 92.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1e913a9cab4d6e1a549197a08f61f0c8f631c062a85b08b901c4fd856b4f7aa8
BLAKE2b-256 checksum
How to use checksums
ab24a67285cbd2aa7e73fb02d7134edb15d2e1f314f49b4a77e4ca1d9b116aab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / django_loknotify-0.1.0-py3-none-any.whl

Download URL django_loknotify-0.1.0-py3-none-any.whl
Size 114.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b5436cfa4beb66f9ac06d8ad947960250b8c6363da868954df668ea2d6908ce
BLAKE2b-256 checksum
How to use checksums
8431bb3198e794ecfa6ff3029ff867d24d83bf70773205bec5ea63205b9ae909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Security for django-loknotify 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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