title: Django, custom error pages redirects to 500 instead of 404
body: <p>I have production server which has these settings:</p>
  
  <pre><code>DEBUG = False
  ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'my.ip.address', 'example.com']
  </code></pre>
  
  <p>Then in my main <code>urls.py</code> file I have added this:</p>
  
  <pre><code>from django.conf.urls import url, include, handler404, handler500
  
  handler500 = 'main.views.error_500'
  handler404 = 'main.views.error_404'
  </code></pre>
  
  <p>My <code>main.views</code> has these:</p>
  
  <pre><code>def error_404(request):
      return render(request, 'main/errors/404.html', status=404)
  
  
  def error_500(request):
      return render(request, 'main/errors/500.html', status=500)
  </code></pre>
  
  <p>When I deploy my production server and try to open page that does not exists, it should redirect to my <code>error_404</code> view. However, it redirects to my <code>error_500</code> view. Why this is happening?</p>