django.db.Error - python examples

Here are the examples of the python api django.db.Error taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 View Complete Implementation : views.py
Copyright Apache License 2.0
Author : bcgov
async def combined_health(request):
    """
    Combined health check including Indy and the database
    """
    ok = True
    disconnected = os.environ.get('INDY_DISABLED', 'false')
    if not disconnected or disconnected == 'false':
        try:
            result = await _indy_client().get_status()
            indy_ok = result and result.get("synced")
            if not indy_ok:
                ok = False
        except IndyRequestError as e:
            ok = False
    def db_check():
        try:
            User.objects.count()
            return True
        except django.db.Error:
            LOGGER.exception("Error during DB health check")
            return False
    ok = ok and await run_django(db_check)
    return web.Response(
        text='ok' if ok else '',
        status=200 if ok else 451)