Adds error page views
This commit is contained in:
parent
ffd403dd47
commit
12bf34e242
2 changed files with 15 additions and 2 deletions
|
@ -23,8 +23,8 @@ status_path = r'%s/(%s)/(?P<status_id>\d+)' % \
|
||||||
|
|
||||||
book_path = r'^book/(?P<book_id>\d+)'
|
book_path = r'^book/(?P<book_id>\d+)'
|
||||||
|
|
||||||
handler404 = 'bookwyrm.vviews.not_found_page'
|
handler404 = 'bookwyrm.views.not_found_page'
|
||||||
handler500 = 'bookwyrm.vviews.server_error_page'
|
handler500 = 'bookwyrm.views.server_error_page'
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
|
|
||||||
|
|
13
bookwyrm/views/error.py
Normal file
13
bookwyrm/views/error.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue