import json

from django.conf import settings
from django.views.decorators.http import require_http_methods
from django.http import HttpResponse

from healthcheck.healthcheck import (
    DjangoDBsHealthCheck, FilesDontExistHealthCheck, HealthChecker)


class JsonResponse(HttpResponse):
    def __init__(self, data, **kwargs):
        kwargs.setdefault('content_type', 'application/json')
        data = json.dumps(data)
        super(JsonResponse, self).__init__(content=data, **kwargs)


class JsonResponseServerError(JsonResponse):
    status_code = 500


@require_http_methods(['GET'])
def status(request):
    checks = []

    if getattr(settings, 'STATUS_CHECK_DBS', True):
        checks.append(DjangoDBsHealthCheck())

    files_to_check = getattr(settings, 'STATUS_CHECK_FILES')
    if files_to_check:
        checks.append(FilesDontExistHealthCheck(
            files_to_check, check_id="quiesce file doesn't exist"))

    ok, details = HealthChecker(checks)()

    if ok and not details:
        details = 'There were no checks.'

    if not ok:
        return JsonResponseServerError(json.dumps(details))

    return JsonResponse(details)

import json

from django.conf import settings
from django.views.decorators.http import require_http_methods
from django.http import HttpResponse

from healthcheck.healthcheck import (
    DjangoDBsHealthCheck, FilesDontExistHealthCheck, HealthChecker)


class JsonResponse(HttpResponse):
    def __init__(self, data, **kwargs):
        kwargs.setdefault('content_type', 'application/json')
        data = json.dumps(data)
        super(JsonResponse, self).__init__(content=data, **kwargs)


class JsonResponseServerError(JsonResponse):
    status_code = 500


@require_http_methods(['GET'])
def status(request):
    checks = []

    if getattr(settings, 'STATUS_CHECK_DBS', True):
        checks.append(DjangoDBsHealthCheck())

    files_to_check = getattr(settings, 'STATUS_CHECK_FILES', None)
    if files_to_check:
        checks.append(FilesDontExistHealthCheck(
            files_to_check, check_id="quiesce file doesn't exist"))

    ok, details = HealthChecker(checks)()

    if ok and not details:
        details = 'There were no checks.'

    if not ok:
        return JsonResponseServerError(json.dumps(details))

    return JsonResponse(details)

Add empty default for STATUS_CHECK_FILES setting
Add empty default for STATUS_CHECK_FILES setting

Given that:
* The line caused an attribute error if the setting wasn't defined,
* The use of getattr was pointless as written since normal attribute access would have worked fine,
* `dict.get` has a default of `None` without having to specify it, and
* The line was followed by a boolean test for the fetched attribute,
I infer that this was the intended meaning.
It should probably be documented somewhere that these settings are required and what they do.
