title: How disable return of HTML error page with django rest framework?
body: <p>If I have a error outside the libs of DRF, django send back the HTML of the error instead of the proper error response use by DRF.</p>
  
  <p>For example:</p>
  
  <pre><code>@api_view(['POST'])
  @permission_classes((IsAuthenticated,))
  def downloadData(request):
      print request.POST['tables']
  </code></pre>
  
  <p>Return the exception <code>MultiValueDictKeyError: "'tables'"</code>. And get back the full HTML. How get only the error a JSON?</p>
  
  <p>P.D:</p>
  
  <p>This is the final code:</p>
  
  <pre><code>@api_view(['GET', 'POST'])
  def process_exception(request, exception):
      # response = json.dumps({'status': status.HTTP_500_INTERNAL_SERVER_ERROR,
      #                        'message': str(exception)})
      # return HttpResponse(response,
      #                     content_type='application/json; charset=utf-8')
      return Response({
          'error': True,
          'content': unicode(exception)},
          status=status.HTTP_500_INTERNAL_SERVER_ERROR
      )
  
  
  class ExceptionMiddleware(object):
      def process_exception(self, request, exception):
          # response = json.dumps({'status': status.HTTP_500_INTERNAL_SERVER_ERROR,
          #                        'message': str(exception)})
          # return HttpResponse(response,
          #                     content_type='application/json; charset=utf-8')
          print exception
          return process_exception(request, exception)
  </code></pre>