how can I do it?
I thought, I can read something from database, but it looks too much, is there something like?:
settings.DATABASES['default'].check_connection()
how can I do it?
I thought, I can read something from database, but it looks too much, is there something like?:
settings.DATABASES['default'].check_connection()
All you need to do is start a application and if its not connected it will fail. Other way you can try is on shell try following -
I had a more complicated case where I am using mongodb behind djongo module, and RDS mysql. So not only is it multiple databases, but djongo throws an SQLDecode error instead. I also had to execute and fetch to get this working:
I load this in my app
__init__.py
, as I want it to run on startup only once and only if DEBUG is enabled. Hope it helps!I use the following Django management command called
wait_for_db
: