views.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:handelsregister 作者: Amsterdam 项目源码 文件源码
def health(request):
    # check database
    try:
        with connection.cursor() as cursor:
            cursor.execute("select 1")
            assert cursor.fetchone()
    except:
        log.exception("Database connectivity failed")
        return HttpResponse(
            "Database connectivity failed",
            content_type="text/plain", status=500)

    # check debug
    if settings.DEBUG:
        log.exception("Debug mode not allowed in production")
        return HttpResponse(
            "Debug mode not allowed in production",
            content_type="text/plain", status=500)

    return HttpResponse("Health OK", content_type='text/plain', status=200)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号