How to setup health check for Django projects in production?

How to setup health check for Django projects in production?

Once you have developed a web application, you would want to make sure that your service is up 24 x 7 and if for some reason the server goes down, then you would be notified. Here comes the use case of health checks for your website. If your application is written in the Django framework,  the best way I have found is to use django-health-check package.

GitHub - KristianOellegaard/django-health-check: a pluggable app that runs a full check on the deployment, using a number of plugins to check e.g. database, queue server, celery processes, etc.
a pluggable app that runs a full check on the deployment, using a number of plugins to check e.g. database, queue server, celery processes, etc. - GitHub - KristianOellegaard/django-health-check: a...

It has extensive support for Django, Celery, database, server memory (ram), server space (hard disk space), Redis, Rabbitmq, and even AWS S3. You have to follow the integration guide mentioned in the official guide, majorly it suggests configuring in settings.py of your Django project to enable the health check monitoring for the services you want to add to your health-check

django-health-check can be used with your AWS Load Balance health check, to monitor the health of  AWS EC2 instances, before serving traffic to those instances, or taking out an unhealthy instance from the target group.

Once you have a health-check endpoint for your website/ web application, now you want to make sure that your Django application is monitored regularly and get notified if something goes wrong. There are multiple platforms, and the most notable one is Pingdom, but however Pingdom is not free, and you might not be willing to pay for such service, then what can you do?

Luckily in today's world, there are multiple SaaS companies that acquire customers using their Freemium model. In such models, you can start using the platform without paying anything with a limited number of features. One such platform for monitoring and uptime check is StatusCake.

StatusCake: Website Monitoring with Uptime Monitoring solution
Website Monitoring solution that drives revenue & keeps you online. Track your uptime, page speed, domain, server, & SSL certificates.

Once you configure the health check endpoint in StatusCake, you need to add the contact groups, so that you can be notified via that channel. Since you can add webhooks to StatusCake, so adding notifications about health checks on slack, discord, email, SMS, voice call, are a few of the options. I personally use discord and email as the primary sources of notification for my website health check status.