任何人都可以逐行给出以下代码的确切说明

时间:2019-06-21 01:58:30

标签: django

数据库连接代码,您能帮助我更好地逐行了解它

//import
from django.db import connections
from django.db.utils import OperationalError

db_conn = connections['default'] 
try:
   c = db_conn.cursor()
except OperationalError:
   connected = False
else:
   connected = True

0 个答案:

没有答案