code: def herokuapp_robots_view(request):
      
  
      response_text = ""
      http_host = request.get_host()
  
      if http_host and 'herokuapp' in http_host:
          response_text = "User-agent: *\nDisallow: /"
  
      return HttpResponse(response_text, content_type="text/plain")
docs: Add restrictive robots.txt to prevent sites under *.herokuapp.com from being indexed.