Registry / database / django-dbconn-retry

django-dbconn-retry

JSON →
library0.2.0pypypiunverified

Patches Django's database connection handling to automatically retry failed connections before raising an error. Useful for environments with brief database unavailability (e.g., container restarts, network blips). Current version 0.2.0, maintained sporadically.

pip install django-dbconn-retry
INSTALL
IMPORT
SIG · DJANGO-DBCONN-RETR
D
django-dbconn-retry
databasepythonv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

patch_conn
from django_dbconn_retry import patch_conn
from djangodbconnretry import patch_conn

Call patch_conn() after Django setup to enable automatic retries on connection failures.

import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') import django django.setup() from djangodbconnretry import patch_conn patch_conn() # Now all DB connections will retry on failure
Debug
Known issues
gotchaThe package only retries connection-time errors, not query-time errors (e.g., deadlocks). It wraps the database wrapper's get_new_connection method, so transient query failures are NOT retried.
fix
Understand the scope: only initial connection failures are retried. For query retries, consider other tools like django-tenacity.
affects: all
gotchapatch_conn() must be called after django.setup() but before any database access. If called too early (before settings are loaded) or too late (after connections already attempted), it may not work as expected.
fix
Ensure django.setup() is called before patch_conn() in your manage.py or wsgi.py setup.
affects: all
deprecatedThe package appears unmaintained (last release 2018). It may not work with Django 2.1+ without modifications due to changes in database backends.
fix
Test with your Django version; consider alternatives like custom database backends or django-retry-if-fails.
affects: Django >= 2.1
Upgrade
Version history
0.2.0latest on PyPI · released Feb 12, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
django-dbconn-retry — pip install django-dbconn-retry · libregistry