mirror of
https://github.com/djohnlewis/stackdump
synced 2024-12-04 23:17:37 +00:00
Added custom 404 page.
This commit is contained in:
parent
9807f0c076
commit
6013a706d7
@ -195,6 +195,14 @@ def site_logos(site_key):
|
||||
def serve_static(filename):
|
||||
return static_file(filename, root=MEDIA_ROOT)
|
||||
|
||||
@error(404)
|
||||
@uses_templates
|
||||
def error404(error):
|
||||
context = { }
|
||||
context['error'] = error
|
||||
|
||||
return render_template('404.html', context)
|
||||
|
||||
@error(500)
|
||||
@uses_templates
|
||||
def error500(error):
|
||||
@ -325,7 +333,7 @@ def view_question(site_key, question_id):
|
||||
query = 'id:%s siteKey:%s' % (question_id, site_key)
|
||||
results = solr_conn().search(query)
|
||||
if len(results) == 0:
|
||||
raise HTTPError(code=404, output='No question exists with the id %s.' % question_id)
|
||||
raise HTTPError(code=404, output='No question exists with the ID %s for the site, %s.' % (question_id, context['site'].name))
|
||||
|
||||
decode_json_fields(results)
|
||||
retrieve_users(results)
|
||||
|
18
python/src/stackdump/templates/404.html
Normal file
18
python/src/stackdump/templates/404.html
Normal file
@ -0,0 +1,18 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}
|
||||
Stackdump - Error 404: Not Found
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row nodata">
|
||||
<div class="span16">
|
||||
<h1>Error 404: Not Found</h1>
|
||||
<p>
|
||||
The page you are looking for could not be found. The error
|
||||
message is:
|
||||
</p>
|
||||
<p><pre>{{ error.output }}</pre></p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user