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
Post a Comment