2

I'm trying to prepare custom 404 and 500 error pages for a production. The 404 works fine, but I'm not able to run the 500.

In my urls.py file:

from client_interface.views.errors.server_error_view import ServerErrorView
handler500 = ServerErrorView.as_view()

client_interface/views/errors/server_error_view.py:

from django.shortcuts import render
from django.views import View


class ServerErrorView(View):
    def get(self, request):
        return render(request, "client_interface/errors/500.html")

I'm getting ?: (urls.E007) The custom handler500 view 'client_interface.views.errors.server_error_view.ServerErrorView' does not take the correct number of arguments (request). error all the time. I tried to change the arguments of the get method to get(request) but it didn't help.

Cobas
  • 37
  • 10
  • https://stackoverflow.com/questions/51639823/custom-error-page-with-django-2-0 – Bijin Abraham Oct 19 '20 at 10:14
  • If I understand correctly, this answer suggests leaving only the request argument in the get method, but as I wrote earlier, it does not help in my case (the error remains the same). – Cobas Oct 19 '20 at 10:20
  • interesting question but `django` itself uses the function based view **FBV** version NOT class based view **CBV** version, just to keep things simple – cizario Oct 19 '20 at 10:25
  • If I use **FBV** for error pages, everything works fine, but the rest of the application is using **CBV**, so I would like to be consistent, if it's possible of course. – Cobas Oct 19 '20 at 11:21

0 Answers0