Install this version:
emerge -a =dev-python/django-redis-7.0.0
If this version is masked, you can unmask it using the autounmask tool or standard emerge options:
autounmask =dev-python/django-redis-7.0.0
Or alternatively:
emerge --autounmask-write -a =dev-python/django-redis-7.0.0
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..14} )
inherit distutils-r1 pypi
DESCRIPTION="Full featured redis cache backend for Django"
HOMEPAGE="
https://github.com/jazzband/django-redis/
https://pypi.org/project/django-redis/
"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RDEPEND="
>=dev-python/django-5.2[${PYTHON_USEDEP}]
>=dev-python/redis-4.0.2[${PYTHON_USEDEP}]
"
BDEPEND="
test? (
dev-db/redis
>=dev-python/lz4-0.15[${PYTHON_USEDEP}]
>=dev-python/msgpack-0.6.0[${PYTHON_USEDEP}]
>=dev-python/pyzstd-0.15[${PYTHON_USEDEP}]
)
"
EPYTEST_PLUGINS=( pytest-{mock,xdist} )
distutils_enable_tests pytest
python_test() {
# no clue why we need to set it explicitly
local -x DJANGO_SETTINGS_MODULE=settings.sqlite
# the test suite only works with -n4
# https://github.com/jazzband/django-redis/issues/777
epytest -o addopts= -n 4 --doctest-modules
}
src_test() {
local redis_pid="${T}"/redis.pid
local redis_port=6379
local redis_sock="${T}"/redis.sock
local redis_test_config="
daemonize yes
pidfile ${redis_pid}
port ${redis_port}
unixsocket ${redis_sock}
bind 127.0.0.1
logfile ${T}/redis.log
enable-debug-command yes
"
local sentinel_pid="${T}"/sentinel.pid
local sentinel_port=26379
# Spawn Redis itself for testing purposes
einfo "Spawning Redis"
einfo "NOTE: Port ${redis_port} must be free"
"${EPREFIX}"/usr/sbin/redis-server - <<< "${redis_test_config}" || die
# Also Redis sentinel
cat > "${T}"/sentinel.conf <<-EOF || die
# from docker/sentinel.conf
sentinel monitor default_service 127.0.0.1 ${redis_port} 1
sentinel down-after-milliseconds default_service 3200
sentinel failover-timeout default_service 10000
# for some reason, tests expect 127.0.0.1 too
sentinel monitor 127.0.0.1 127.0.0.1 ${redis_port} 1
sentinel down-after-milliseconds 127.0.0.1 3200
sentinel failover-timeout 127.0.0.1 10000
daemonize yes
pidfile ${sentinel_pid}
port ${sentinel_port}
logfile ${T}/sentinel.log
EOF
"${EPREFIX}"/usr/sbin/redis-sentinel "${T}"/sentinel.conf || die
# Update the socket path, we don't want hardcoded /tmp
sed -e "s^/tmp/redis.sock^${redis_sock}^g" \
-i tests/settings/sqlite_usock.py || die
# Run the tests
distutils-r1_src_test
# Clean up afterwards
kill "$(<"${sentinel_pid}")" "$(<"${redis_pid}")" || die
}
>=dev-python/django-5.2[] >=dev-python/redis-4.0.2[]
test? ( dev-db/redis >=dev-python/lz4-0.15[] >=dev-python/msgpack-0.6.0[] >=dev-python/pyzstd-0.15[] )