{"id":37071680,"url":"https://github.com/cloudblue/django-postgresql-reconnect","last_synced_at":"2026-01-14T08:24:38.788Z","repository":{"id":49870992,"uuid":"518395681","full_name":"cloudblue/django-postgresql-reconnect","owner":"cloudblue","description":"PostgreSQL database reconnection helper","archived":false,"fork":false,"pushed_at":"2025-06-23T12:11:58.000Z","size":51,"stargazers_count":9,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-27T18:02:45.648Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudblue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-27T09:37:30.000Z","updated_at":"2023-05-07T03:09:11.000Z","dependencies_parsed_at":"2023-02-11T05:55:14.698Z","dependency_job_id":null,"html_url":"https://github.com/cloudblue/django-postgresql-reconnect","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/cloudblue/django-postgresql-reconnect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudblue%2Fdjango-postgresql-reconnect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudblue%2Fdjango-postgresql-reconnect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudblue%2Fdjango-postgresql-reconnect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudblue%2Fdjango-postgresql-reconnect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudblue","download_url":"https://codeload.github.com/cloudblue/django-postgresql-reconnect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudblue%2Fdjango-postgresql-reconnect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:16:59.381Z","status":"ssl_error","status_checked_at":"2026-01-14T08:13:45.490Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T08:24:38.036Z","updated_at":"2026-01-14T08:24:38.778Z","avatar_url":"https://github.com/cloudblue.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django PostgreSQL backend with reconnection support\n![pyversions](https://img.shields.io/pypi/pyversions/django-postgresql-reconnect.svg)\n[![PyPi Status](https://img.shields.io/pypi/v/django-postgresql-reconnect.svg)](https://pypi.org/project/ddjango-postgresql-reconnect/)\n[![Docs](https://readthedocs.org/projects/django-postgresql-reconnect/badge/?version=latest)](https://readthedocs.org/projects/django-postgresql-reconnect)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=django-postgresql-reconnect\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=django-postgresql-reconnect)\n[![PyPI status](https://img.shields.io/pypi/status/django-postgresql-reconnect.svg)](https://pypi.python.org/pypi/django-postgresql-reconnect/)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=django-postgresql-reconnect\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=django-postgresql-reconnect)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/django-postgresql-reconnect)](https://pypi.org/project/django-postgresql-reconnect/)\n\n## Introduction\n\nIn some cases (network connection lost, load balancer issues) the connection to the database is lost without giving Django a notification.\nDjango tries to use such a connection and gets errors because of it. For a correct recovery, we need to restart the application workers.\n\n## Install\n\n```\n$ pip install django-postgresql-reconnect\n```\n\n## Integration\n\n### Handling connection issues when processing HTTP requests\n\n```python\n# settings.py\n\nDATABASES = {\n    # The database back end that performs reconnect when the connection is closed\n    'default': {\n        'ENGINE': 'django_postgresql_reconnect.backend',\n        'NAME': 'db_name',\n        'USER': 'db_user',\n        'PASSWORD': 'pwd',\n        'HOST': 'db_host',\n        'RECONNECT': True,\n    },\n}\n\nMIDDLEWARE = [\n    # Middleware checks and reconnects before processing requests\n    'django_postgresql_reconnect.middleware',\n    ...\n]\n```\n\n### Decorator for using in other places.\nFor example, in management commands.\n```python\n\nimport django_postgresql_reconnect\n\n@django_postgresql_reconnect.decorator\ndef some_awesome_function():\n    ...\n```\n\n\n\n## Testing\n\n1. Python 3.8+\n0. Install dependencies `pip install poetry \u0026\u0026 poetry install`\n\nCheck code style: `poetry run flake8`\nRun tests: `poetry run pytest`\n\nTests reports are generated in `tests/reports`.\n* `out.xml` - JUnit test results\n* `coverage.xml` - Coverage xml results\n\nTo generate HTML coverage reports use:\n`--cov-report html:tests/reports/cov_html`\n\n## License\n\n`Django PostgreSQL Reconnect` is released under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudblue%2Fdjango-postgresql-reconnect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudblue%2Fdjango-postgresql-reconnect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudblue%2Fdjango-postgresql-reconnect/lists"}