django-db-geventpool
Add a DB connection pool using gevent to django
What it is and what it does
django-db-geventpool adds a connection pooling layer to Django's PostgreSQL backend using gevent or eventlet. Instead of opening a new database connection for each request, it maintains a pool of reusable connections, reducing the overhead of connection setup and teardown in high-concurrency environments.
The package works by replacing Django's default database backend with a pooled variant. You configure it in Django settings by specifying the pool engine, setting maximum connections (default 4), and optionally the number of connections to reuse across requests. The package includes a decorator utility to clean up connections when using greenlets outside the normal request cycle (e.g., in Celery tasks).
Use it for:
- Running Django under a gevent-based application server to reduce database connection churn in high-request-rate scenarios.
- Using Django with task queues that spawn greenlets, where manual connection cleanup is needed to avoid connection leaks.
- Deploying Django applications on systems with strict connection limits where connection pooling significantly improves throughput.
- Switching between psycopg2 and psycopg3 backends while maintaining gevent compatibility.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a gevent-based connection pool for Django's PostgreSQL database backend, reducing connection overhead in concurrent applications.
Yes, if you are running Django with gevent workers and need connection pooling. The low install friction and permissive Apache-2.0 license make it a straightforward addition. However, the aging maintenance status (537 days since last activity) and the fact that Django 5.1+ now has native pool support mean you should verify compatibility with your specific Django and database driver version before committing to production use.
Install
django-db-geventpool on PyPI
pip
pip install django-db-geventpooluv
uv add django-db-geventpoolpoetry
poetry add django-db-geventpoolInstalling django-db-geventpool
Before you install
Low friction to install; depends only on django. Maintenance status is aging—last release was 2025-02-23 but no activity for 537 days prior, and the repository shows 189 stars with no indication of active development.
License in practice
Licensed under Apache-2.0 (permissive), so you can use it freely in commercial and private projects without copyleft obligations.
Quickstart
# Install
pip install django-db-geventpool
# In Django settings.py, configure the pooled backend:
DATABASES = {
'default': {
'ENGINE': 'django_db_geventpool.backends.postgresql_psycopg3',
'NAME': 'mydb',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': 'localhost',
'CONN_MAX_AGE': 0,
'OPTIONS': {
'MAX_CONNS': 20,
'REUSE_CONNS': 10
}
}
}
Requires gevent or eventlet to be installed separately. For Django 5.1+, native pool support must be disabled by setting 'pool': False in OPTIONS.
Verify before relying
- Whether the package works reliably with Django 5.1+ given the native pool support changes mentioned in the description.
- Current compatibility status with modern psycopg3 versions and whether additional patching is still necessary.
- Whether the aging maintenance status reflects active use or declining adoption in the Django ecosystem.
- What external dependencies (gevent, eventlet, or driver-specific patches) must be installed separately.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — django |
| Maintenance | aging — 537 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 90,253/month — #13,607 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_db_geventpool-4.0.8-py2.py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
psycogreenIntegrates psycopg2 with coroutine libraries…
permissive · top 5,000 on PyPI
psycopg-poolProvides a connection pool for Psycopg 3,…
copyleft · top 1,000 on PyPI
dj-database-urlParses DATABASE_URL environment variables into…
permissive · top 5,000 on PyPI
psycopg2-poolManages a pool of reusable PostgreSQL…
copyleft · top 15,000 on PyPI
geventhttpclientA concurrent HTTP client for gevent that…
permissive · top 5,000 on PyPI
django-db-connection-poolProvides connection pooling for Django database…
permissive · top 15,000 on PyPI
geventgevent provides lightweight concurrent…
permissive · top 1,000 on PyPI
psycopgPsycopg 3 is a PostgreSQL database adapter for…
copyleft · top 1,000 on PyPI
postgresProvides a lightweight abstraction layer over…
permissive · top 15,000 on PyPI
watchdog-geventProvides a gevent-based file system event…
unclear · top 15,000 on PyPI