Closed raydoom closed 1 year ago
The traceback indicates it cannot access the redid cache. How did you install Django-ca, what version, which Python version? And in this case, what redis version are you using?
I use docker ,follow the doc from https://django-ca.readthedocs.io/en/latest/docker.html
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
52ef60f773a9 redis "docker-entrypoint.s…" 18 hours ago Up 18 hours 6379/tcp redis
85cae7d1a3e1 nginx "/docker-entrypoint.…" 19 hours ago Up 19 hours 0.0.0.0:80->80/tcp, :::80->80/tcp nginx
fb231e423bcd mathiasertl/django-ca "/bin/sh -c ./uwsgi.…" 19 hours ago Up 19 hours 8000/tcp frontend
d6a843d71b68 mathiasertl/django-ca "./celery.sh" 19 hours ago Up 19 hours 8000/tcp backend
5b1ca4eaf8ea postgres "docker-entrypoint.s…" 19 hours ago Up 19 hours 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres
and I run a redis-cli in django-ca network,it connect to redis successfully.
[root@07ff743e49b0 /]# redis-cli -h redis
redis:6379> info
# Server
redis_version:7.0.11
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:5c712dc4cb9cfb70
redis_mode:standalone
os:Linux 4.18.0-425.13.1.el8_7.x86_64 x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:10.2.1
process_id:1
process_supervised:no
run_id:a0e0ad0bd064b3573034d85dbaa059abcf799272
tcp_port:6379
server_time_usec:1686620120404552
uptime_in_seconds:64491
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:8898520
executable:/data/redis-server
config_file:
io_threads_active:0
Hi @raydoom ,
I found the problem: There is a mistake in the documentation, the DB
value should be db
. Change localsettings.yaml
like this:
CACHES:
default:
BACKEND: django.core.cache.backends.redis.RedisCache
LOCATION: redis://redis:6379
OPTIONS:
- DB: "1"
+ db: "1"
# django-ca will use Celery as an asynchronous task worker
CELERY_BROKER_URL: redis://redis:6379/0
This should solve the problem!
I also just added a test script to test that everything can connect properly, making such mistakes impossible in the future. :-)
kr, Mat
@raydoom I think the issue is solved. If you still have issues with connecting to redis, please comment here. If you experience other issues, please don't hesitate to create a new issue!
I'll leave this issue open for a week unless there is negative feedback, please feel free to close the issue if everything works for you.
kr, Mat
it work ,thanks