Provides useful context managers for PostgreSQL advisory locks in Django. Version 1.0.4 (latest) released Aug 2021. Low maintenance, stable, no major changes expected.
pip install django-pglocksNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Acquire a PostgreSQL advisory lock using a string key. The lock is released when the context exits.
Always use the context manager; avoid manual acquire/release.
Use unique, descriptive key strings; consider prepending a namespace.
Keep the same database connection active within the lock context.
Ensure the lock is acquired inside a view or management command where a DB connection is available.
Use different keys for nested locks or avoid nesting same-key locks.
Run `pip install django-pglocks`.