Registry / database / django-db-geventpool

django-db-geventpool

JSON →
library4.0.8pypypiunverified

Provides a DB connection pool using gevent for Django, allowing concurrent database access in a gevent-ready manner. Current version 4.0.8, supports Django >= 4.2 and psycopg2/psycopg3. Release cadence is irregular.

pip install django-db-geventpool
INSTALL
IMPORT
SIG · DJANGO-DB-GEVENTPO
D
django-db-geventpool
databasepythonv4.0.8
Install
3.3s avg
Import
—
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v4.0.8 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.4MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.3s · import 0.000s · 67MB
66MB installed
● package 66MB
Code
Verified usage

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

DatabaseWrapper
✓ from django_db_geventpool import DatabaseWrapper
✗ from django_db_geventpool.backends.postgresql import DatabaseWrapper

Basic usage: monkey-patch gevent early, then use Django ORM normally. Pool is automatically used if DATABASES configuration includes OPTIONS with pool settings.

import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') import django django.setup() from django.db import connection cursor = connection.cursor() cursor.execute("SELECT 1") print(cursor.fetchone()) # Ensure gevent is patched early; use gevent.monkey.patch_all() before importing django
Debug
Known issues
breakingVersion 4.0.0 dropped support for Django < 3.1. Version 4.0.8 drops support for Django < 4.2. Upgrade your Django version if you're on an older release.
fix
Upgrade Django to >=4.2, and use django-db-geventpool >=4.0.8.
affects: <=4.0.0
gotchaYou must call gevent.monkey.patch_all() before importing any Django modules, including settings. Otherwise, database connections will not be patched and may deadlock.
fix
Place 'import gevent.monkey; gevent.monkey.patch_all()' as the very first lines of your application entry point (e.g., wsgi.py, manage.py).
affects: all
gotchaWhen using psycopg3 (psycopg package), ensure you set 'ENGINE': 'django_db_geventpool.backends.postgresql_psycopg2' even if using psycopg3. The pool backend is the same; psycopg3 support is enabled via the driver setting.
fix
Use ENGINE as shown in the docs and set 'OPTIONS': {'psycopg3': True} in your DATABASES config.
affects: >=4.0.3
deprecatedDirect import of backends from django_db_geventpool is deprecated. Use Django's default engine paths with custom OPTIONS instead.
fix
Configure DATABASES as documented, e.g. 'ENGINE': 'django_db_geventpool.backends.postgresql_psycopg2'.
affects: >=4.0
Upgrade
Version history
4.0.8latest on PyPI · released Feb 23, 2025
Audit
Dependencies
geventrequiredCore dependency for pool and monkey-patching
djangorequiredFramework integration
psycopg2-binaryoptionalDefault PostgreSQL driver
psycopg2optionalAlternative PostgreSQL driver
psycopgoptionalPostgreSQL driver (psycopg3), supported from v4.0.3
Agent activity
12 hits · last 30 days
node
12
Resources
django-db-geventpool — pip install django-db-geventpool · libregistry