python - how can I check database connection to mysql in django -


how can it?

i thought, can read database, looks much, there like?:

settings.databases['default'].check_connection() 

all need start application , if not connected fail. other way can try on shell try following -

from django.db import connections django.db.utils import operationalerror db_conn = connections['default'] try:     c = db_conn.cursor() except operationalerror:     connected = false else:     connected = true 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -