Skip to content

Commit

Permalink
Added: route and views for error and 500 pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvind-4 committed Sep 29, 2023
1 parent b586aa5 commit ac95ee8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
from django.conf import settings

from landing.views import HomeView
from django.views.generic import TemplateView

urlpatterns = [
path(str(settings.ADMIN_URL), admin.site.urls),
path('', HomeView.as_view()),
path('404', TemplateView.as_view(template_name='404.html')),
path('*', TemplateView.as_view(template_name='404.html')),
]

handler404 = 'landing.views.custom_404'
handler500 = 'landing.views.custom_500'
10 changes: 9 additions & 1 deletion landing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ def post(self, request, *args, **kwargs):
context = {
'form': form,
}
return render(request, 'home_view.html', context=context)
return render(request, 'home_view.html', context=context)



def custom_404(request, exception, *args, **kwargs):
return render(request, '404.html', status=404)

def custom_500(request, *args, **kwargs):
return render(request, '500.html', status=500)

0 comments on commit ac95ee8

Please sign in to comment.