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

javascript - Can Piwik report referrer in real time? -

asp.net - Google Drive Access: At least one client secrets (Installed or Web) should be set -

excel vba add hyperlink to shape in group -