[WEB-621] chore: 404 page not found (#3859)

* chore: custom 404 error

* chore: moved from middleware to view
This commit is contained in:
Bavisetti Narayan 2024-03-06 14:24:58 +05:30 committed by GitHub
parent 5a32d10f96
commit 4572b7378d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View File

@ -187,4 +187,6 @@ from .webhook import (
from .dashboard import ( from .dashboard import (
DashboardEndpoint, DashboardEndpoint,
WidgetsEndpoint WidgetsEndpoint
) )
from .error_404 import custom_404_view

View File

@ -0,0 +1,5 @@
# views.py
from django.http import JsonResponse
def custom_404_view(request, exception=None):
return JsonResponse({"error": "Page not found."}, status=404)

View File

@ -7,6 +7,7 @@ from django.views.generic import TemplateView
from django.conf import settings from django.conf import settings
handler404 = "plane.app.views.error_404.custom_404_view"
urlpatterns = [ urlpatterns = [
path("", TemplateView.as_view(template_name="index.html")), path("", TemplateView.as_view(template_name="index.html")),