Am trying to create a custom error handling page for production, when am working with local project I noticed am getting error 500 for most of the pages, except few page.
ERROR I get is
Exception occurred during processing of request from ('127.0.0.1', 52141)
Traceback (most recent call last):
File "E:\Dev\Python\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "E:\Dev\Python\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "E:\Dev\Python\lib\socketserver.py", line 720, in __init__
self.handle()
File "e:\Dev\REPOS\2021 PROJECTS\cognizance_cms\.env\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
self.handle_one_request()
File "e:\Dev\REPOS\2021 PROJECTS\cognizance_cms\.env\lib\site-packages\django\core\servers\basehttp.py", line 182, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "E:\Dev\Python\lib\socket.py", line 704, in readinto
return self._sock.recv_into(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
I have followed all the steps properly and my custom 500 page loads, but the pages such as login which used to work gets error 500.
If more input his needed let me know I'll add them. I have referred most of the issues raised, nothing seems to be conclusive.
I tried:
# settings.py
DEBUG = False
ALLOWED_HOSTS = ['*']
as a hotfix. I know it should not be done, still it didn't work
# views.py in project directory
def error_404_view(request,exception):
return render(request,'404.html')
def error_500_view(request):
return render(request,'pages/500.html')
# urls.py in project
handler404 = 'pages.views.error_404_view'
handler500 = 'pages.views.error_500_view'