def is_database_correctly_configured():
import peewee
import config
configured = False
cannot_connect_message = "Cannot connect to database. Please ensure database service is running and user access is properly configured in 'sentinel.conf'."
try:
db = config.db
db.connect()
configured = True
except (peewee.ImproperlyConfigured, peewee.OperationalError, ImportError) as e:
print("[error]: %s" % e)
print(cannot_connect_message)
sys.exit(1)
return configured
评论列表
文章目录