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
|
@ -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 %}
|
||||||
|
|
|
@ -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
|
status_path = r'%s/(status|review|comment)/(?P<status_id>\d+)' % local_user_path
|
||||||
book_path = r'^book/(?P<book_identifier>[\w\-]+)'
|
book_path = r'^book/(?P<book_identifier>[\w\-]+)'
|
||||||
|
|
||||||
|
handler404 = 'fedireads.views.not_found_page'
|
||||||
|
handler500 = 'fedireads.views.server_error_page'
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,16 @@ def is_api_request(request):
|
||||||
request.path[-5:] == '.json'
|
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
|
@login_required
|
||||||
def home(request):
|
def home(request):
|
||||||
''' this is the same as the feed on the home tab '''
|
''' this is the same as the feed on the home tab '''
|
||||||
|
|
Loading…
Reference in New Issue