title: Override Django Handler404 with JSON type handler
body: <p>I'm using Django 2.0.1 and I'm trying to override Django 404 page with another response. Instead of returning a regular template, I want to return a JSON response.</p>
  
  <p>here is my project/urls.py</p>
  
  <pre><code>from django.conf.urls import include
  from django.contrib import admin
  from django.urls import path
  from django.conf.urls import handler404
  from django.http import JsonResponse
  
   urlpatterns = [
  
      path('admin/', admin.site.urls),
      path('users/', include('accounts.urls'))
  ]
  
  
  def response404(request, status=200, message='Not Found', data=None):
      data = {'status': 404, 'message': message, 'data': data}
      return JsonResponse(data=data, status=status)
  
  def response500(request, status=500, message='Not Found', data=None):
      data = {'status': status, 'message': message, 'data': data}
      return JsonResponse(data=data, status=status)
  
  
  
  handler404 = response404
  handler500 = response505
  </code></pre>
  
  <p>and in accounts/urls/py</p>
  
  <pre><code>from django.urls import path
  
  from .views import UserView, AuthenticationView
  
  urlpatterns = [
      path('', UserView.as_view()),
      path('auth/', AuthenticationView.as_view()),
  ]
  </code></pre>
  
  <p>but by it 404 returns it still return me the basic Django 404 page even if I change Debug option to True in settings.py file</p>