from django.http import HttpResponse


class HttpResponseNoContent(HttpResponse):
    status_code = 204

def my_view(request):
    return HttpResponseNoContent()
How can I return HTTP status code 204 from a Django view?