{"id":26901,"library":"django-dbconn-retry","title":"django-dbconn-retry","description":"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.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/jdelic/django-dbconn-retry","tags":["django","database","retry","connection"],"install":[{"cmd":"pip install django-dbconn-retry","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Wrong package name: correct is djangodbconnretry (no hyphens or underscores)","wrong":"from django_dbconn_retry import patch_conn","symbol":"patch_conn","correct":"from djangodbconnretry import patch_conn"}],"quickstart":{"code":"import os\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')\n\nimport django\ndjango.setup()\n\nfrom djangodbconnretry import patch_conn\npatch_conn()\n\n# Now all DB connections will retry on failure","lang":"python","description":"Call patch_conn() after Django setup to enable automatic retries on connection failures."},"warnings":[{"fix":"Understand the scope: only initial connection failures are retried. For query retries, consider other tools like django-tenacity.","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure django.setup() is called before patch_conn() in your manage.py or wsgi.py setup.","message":"patch_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.","severity":"gotcha","affected_versions":"all"},{"fix":"Test with your Django version; consider alternatives like custom database backends or django-retry-if-fails.","message":"The package appears unmaintained (last release 2018). It may not work with Django 2.1+ without modifications due to changes in database backends.","severity":"deprecated","affected_versions":"Django >= 2.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from djangodbconnretry import patch_conn'","cause":"Using hyphens or underscores in the package name for import; the correct import is 'djangodbconnretry'.","error":"ImportError: No module named django_dbconn_retry"},{"fix":"Check Django version compatibility. For Django >= 2.1, consider writing your own database backend wrapper or using a modern alternative.","cause":"The package monkey-patches an internal Django method that may have changed or been removed in newer Django versions.","error":"AttributeError: module 'django.db.backends.base.base' has no attribute 'get_new_connection'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}