Skip to main content

Django Postgres Lock

A Django management command which will run a command inside a Postgres lock, ensuring that only a single instance of the inner command will run.

Installation

Using pip:

$ pip install django-postgres-lock

Edit your Django project's settings module, and add the application to INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "postgres_lock",
    # ...
]

Usage

To run clearsessions with the default lock:

$ ./manage.py command_lock -- ./manage.py clearsessions

To use a unique lock for this task:

$ ./manage.py command_lock --name clearsessions -- ./manage.py clearsessions

To exit immediately if a lock can't be acquired:

$ ./manage.py command_lock --try --name clearsessions -- ./manage.py clearsessions

To ignore a lock failure and return a successful exit code:

$ ./manage.py command_lock --try --ignore-fail --name clearsessions -- ./manage.py clearsessions

Release files for django-postgres-lock 0.3

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-postgres-lock 0.3
File Size Uploaded
django_postgres_lock-0.3.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-postgres-lock 0.3
File Interpreter ABI Platform
django_postgres_lock-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / django_postgres_lock-0.3.tar.gz

Download URL django_postgres_lock-0.3.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0aa6fbbdd592d66d904220c7e332f70b45b0cbb89457169a3d895e03fe87b63f
BLAKE2b-256 checksum
How to use checksums
8539434142675ba6d64f6902f3a603474c6924c33695e1ab13245d1208d768df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release files / django_postgres_lock-0.3-py3-none-any.whl

Download URL django_postgres_lock-0.3-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee4ceaa24b42a8294f27e0cfb40248b348a5aa7a699ce3993787ab65427bf94e
BLAKE2b-256 checksum
How to use checksums
94429b4464482bf0673adba3eae91836fae1f8484adcf4c1a83c5bab556c6898
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

2 release files

0.1.1

2 release files

0.1

2 release files

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