Created
October 19, 2020 00:14
-
-
Save CryceTruly/5fba462bc8eb17ee5ac5351441af4dd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import JsonResponse | |
def error_404(request, exception): | |
message = ("The endpoint you are trying to access might " | |
"have been removed, " | |
"had its name changed, or is temporarily unavailable. " | |
"Please check the documentation here : " | |
"/ docs and try again later.") | |
response = JsonResponse(data={"message": message, 'status_code': 404}) | |
response.status_code = 404 | |
return response | |
def error_500(request): | |
message = ("The server encountered some issue. This will get resolved soon") | |
response = JsonResponse(data={"message": message, 'status_code': 500}) | |
response.status_code = 500 | |
print(response) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment