#How to run a Redis listener in Django when the server starts?

11 messages · Page 1 of 1 (latest)

faint canopy
#

I'm working with Django and I have a Redis listener that I run with the following custom command:

python manage.py listen_redis

However, I want the Redis listener to start automatically when I run the Django development server with:

python manage.py runserver

I would like this Redis listener to run concurrently with the Django development server without needing to manually start it via a custom management command.

How can I achieve this?

Or is it not a bad thing to run the script separately?

My full code is linked below, please forgive me but I dont know how to format code in this editor.

https://stackoverflow.com/questions/79333851/how-to-run-a-redis-listener-in-django-when-the-server-starts

zenith mesa
#

What does this listen_redis command do?

faint canopy
#

it listens to redis for notifications sent to it

#

and then processes those notifications

zenith mesa
#

Then it sounds like a worker process, and should be it's own process and not mingled with the WSGI process?

faint canopy
zenith mesa
#

Yes

faint canopy
#

ok, that is what i am currentlly doing

last pond
#

it will start both services.

zenith mesa
#

No, it will not. It will start the redis listener, and when you terminale it it will (depending on return code, thus probably not), start/not start runserver....