Adds 404 and 500 pages

they only show up when debug is off though, thankfully
Fixes #112
This commit is contained in:
Mouse Reeve 2020-03-29 16:05:33 -07:00
parent e7d18dada1
commit c6d887defe
4 changed files with 31 additions and 0 deletions

View 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 %}

View 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 %}

View file

@ -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),

View file

@ -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 '''