forked from github/plane
[WEB-621] chore: 404 page not found (#3859)
* chore: custom 404 error * chore: moved from middleware to view
This commit is contained in:
parent
5a32d10f96
commit
4572b7378d
@ -187,4 +187,6 @@ from .webhook import (
|
|||||||
from .dashboard import (
|
from .dashboard import (
|
||||||
DashboardEndpoint,
|
DashboardEndpoint,
|
||||||
WidgetsEndpoint
|
WidgetsEndpoint
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from .error_404 import custom_404_view
|
||||||
|
5
apiserver/plane/app/views/error_404.py
Normal file
5
apiserver/plane/app/views/error_404.py
Normal 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)
|
@ -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")),
|
||||||
|
Loading…
Reference in New Issue
Block a user