This question have been asked here: django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)") and the answer has been to wait for the database to be ready.
However, the official documentation here: https://docs.docker.com/compose/startup-order/ suggests that instead an in app retry method is implemented in order to retry the database connection when this fails.
To handle this, design your application to attempt to re-establish a connection to the database after a failure. If the application retries the connection, it can eventually connect to the database.
The best solution is to perform this check in your application code, both at startup and whenever a connection is lost for any reason.
Unfortunately, the documentation just ends there and does not provide any examples or guides on how to implement this retry method. Does anyone knows how to do that in a clean way?
Restart django cassandra conection in manage.py