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

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -