1. 程式人生 > >Mysql has gone way (Django 下的解決方法)

Mysql has gone way (Django 下的解決方法)

nal app rgs log exc wrap rational blog one

def is_connection_usable(func):
def wrapper(*args, **kwargs):
result = None
try:
result = func(*args, **kwargs)
result[0]
except OperationalError:
connection.close()
result = func(*args, **kwargs)
return result
return wrapper

Mysql has gone way (Django 下的解決方法)