mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-05-08 14:47:09 +00:00
21 lines
627 B
Python
21 lines
627 B
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
from django.shortcuts import render
|
|
from django.http import JsonResponse
|
|
|
|
|
|
def handler404(request, *args, **argv):
|
|
if request.content_type.find('application/json') > -1:
|
|
response = JsonResponse({'error': 'Not found'}, status=404)
|
|
else:
|
|
response = render(request, '404.html', status=404)
|
|
return response
|
|
|
|
|
|
def handler500(request, *args, **argv):
|
|
if request.content_type.find('application/json') > -1:
|
|
response = JsonResponse({'error': 'Server internal error'}, status=500)
|
|
else:
|
|
response = render(request, '500.html', status=500)
|
|
return response
|