mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 17:41:08 +00:00
Adds 404 and 500 pages
they only show up when debug is off though, thankfully Fixes #112
This commit is contained in:
parent
e7d18dada1
commit
c6d887defe
4 changed files with 31 additions and 0 deletions
10
fedireads/templates/error.html
Normal file
10
fedireads/templates/error.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
|
||||
<div class="content-container">
|
||||
<h2>Server Error</h2>
|
||||
<p>Something went wrong! Sorry about that.</p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
9
fedireads/templates/notfound.html
Normal file
9
fedireads/templates/notfound.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
|
||||
<div class="content-container">
|
||||
<h2>Not Found</h2>
|
||||
<p>The page your requested doesn't seem to exist!</p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -13,6 +13,8 @@ local_user_path = r'^user/%s' % localname_regex
|
|||
status_path = r'%s/(status|review|comment)/(?P<status_id>\d+)' % local_user_path
|
||||
book_path = r'^book/(?P<book_identifier>[\w\-]+)'
|
||||
|
||||
handler404 = 'fedireads.views.not_found_page'
|
||||
handler500 = 'fedireads.views.server_error_page'
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
|
||||
|
|
|
@ -25,6 +25,16 @@ def is_api_request(request):
|
|||
request.path[-5:] == '.json'
|
||||
|
||||
|
||||
def server_error_page(request):
|
||||
''' 500 errors '''
|
||||
return TemplateResponse(request, 'error.html')
|
||||
|
||||
|
||||
def not_found_page(request, _):
|
||||
''' 404s '''
|
||||
return TemplateResponse(request, 'notfound.html')
|
||||
|
||||
|
||||
@login_required
|
||||
def home(request):
|
||||
''' this is the same as the feed on the home tab '''
|
||||
|
|
Loading…
Reference in a new issue