Adds error page views

This commit is contained in:
Mouse Reeve 2021-01-13 12:08:51 -08:00
parent ffd403dd47
commit 12bf34e242
2 changed files with 15 additions and 2 deletions

View file

@ -23,8 +23,8 @@ status_path = r'%s/(%s)/(?P<status_id>\d+)' % \
book_path = r'^book/(?P<book_id>\d+)'
handler404 = 'bookwyrm.vviews.not_found_page'
handler500 = 'bookwyrm.vviews.server_error_page'
handler404 = 'bookwyrm.views.not_found_page'
handler500 = 'bookwyrm.views.server_error_page'
urlpatterns = [
path('admin/', admin.site.urls),

13
bookwyrm/views/error.py Normal file
View file

@ -0,0 +1,13 @@
''' something has gone amiss '''
from django.template.response import TemplateResponse
def server_error_page(request):
''' 500 errors '''
return TemplateResponse(
request, 'error.html', {'title': 'Oops!'}, status=500)
def not_found_page(request, _):
''' 404s '''
return TemplateResponse(
request, 'notfound.html', {'title': 'Not found'}, status=404)