File: apps.py

package info (click to toggle)
python-django-health-check 3.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 428 kB
  • sloc: python: 1,886; makefile: 6
file content (29 lines) | stat: -rw-r--r-- 881 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from django.apps import AppConfig
from django.conf import settings

from health_check.plugins import plugin_dir


class HealthCheckConfig(AppConfig):
    name = "health_check.contrib.psutil"

    def ready(self):
        from .backends import DiskUsage, MemoryUsage

        # Ensure checks haven't been explicitly disabled before registering
        if (
            hasattr(settings, "HEALTH_CHECK")
            and ("DISK_USAGE_MAX" in settings.HEALTH_CHECK)
            and (settings.HEALTH_CHECK["DISK_USAGE_MAX"] is None)
        ):
            pass
        else:
            plugin_dir.register(DiskUsage)
        if (
            hasattr(settings, "HEALTH_CHECK")
            and ("DISK_USAGE_MAX" in settings.HEALTH_CHECK)
            and (settings.HEALTH_CHECK["MEMORY_MIN"] is None)
        ):
            pass
        else:
            plugin_dir.register(MemoryUsage)