skillfed

django-db-geventpool

Add a DB connection pool using gevent to django

django-db-geventpool v4.0.8 90.3K downloads/30d#13,607 on PyPI189
Permissive license Apache-2.0 AGING released

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-geventpool

uv

uv add django-db-geventpool

poetry

poetry add django-db-geventpool

Installing 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

Environment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 3.2Framework :: Django :: 4.2Framework :: Django :: 5.0Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Application Frameworks

Tags

django postgresql connection poolgevent db pool djangodjango database poolingpsycopg connection poolingdjango concurrent databasegreenlet database connectionsdjango connection reuse
connection-poolinggeventpostgresql

More Application Frameworks packages