About Pinged Pages and HEAD Request
If you use UptimeRobot, Oh Dear, PingPing, or other service to monitor your website's uptime, make sure to handle the HEAD requests for the pinged page early in the view, so that you don't load any unnecessary queries and don't render the templates for it:
from django.shortcuts import render
from django.http import HttpResponse
def home(request, *args, **kwargs):
if request.method == "HEAD":
return HttpResponse()
context = {...}
return render(request, "startpage/index.html", context)
Tips and Tricks Dev Ops Development Django 5.2 Django 4.2 Django 3.2
Also by me
Django Messaging 🎅🏼
For Django-based social platforms.
Django Paddle Subscriptions 🎅🏼
For Django-based SaaS projects.
Django GDPR Cookie Consent 🎅🏼
For Django websites that use cookies.