mirror of
https://github.com/shouptech/humulus.git
synced 2026-02-03 19:39:43 +00:00
Compare commits
2 commits
8e949d18e4
...
95e5a35295
| Author | SHA1 | Date | |
|---|---|---|---|
| 95e5a35295 | |||
| de9f4f1e68 |
4 changed files with 49 additions and 2 deletions
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask, render_template
|
||||||
|
|
||||||
|
|
||||||
def create_app(test_config=None):
|
def create_app(test_config=None):
|
||||||
|
|
@ -55,4 +55,22 @@ def create_app(test_config=None):
|
||||||
from . import filters
|
from . import filters
|
||||||
filters.create_filters(app)
|
filters.create_filters(app)
|
||||||
|
|
||||||
|
# Register custom error handlers
|
||||||
|
app.register_error_handler(400, bad_request)
|
||||||
|
app.register_error_handler(404, page_not_found)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
def bad_request(e):
|
||||||
|
return (
|
||||||
|
render_template('_error.html', code=400, message='400 Bad Request'),
|
||||||
|
400
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def page_not_found(e):
|
||||||
|
return (
|
||||||
|
render_template('_error.html', code=404, message='404 Not Found'),
|
||||||
|
404
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,5 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.above-footer {
|
.above-footer {
|
||||||
padding-bottom: 12rem;
|
padding-bottom: 14rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
src/humulus/templates/_error.html
Normal file
24
src/humulus/templates/_error.html
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{#-
|
||||||
|
Copyright 2019 Mike Shoup
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-#}
|
||||||
|
{% extends '_base.html' %}
|
||||||
|
{% block title %}Home{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="text-center">
|
||||||
|
<img src="https://http.cat/{{ code }}" alt="{{ message }}">
|
||||||
|
<p>Error messages from <a href="https://http.cat/">HTTP Cats</a></p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -137,6 +137,11 @@
|
||||||
<div class="bg-info text-white">
|
<div class="bg-info text-white">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col text-right">
|
||||||
|
<a class="text-white" href="#" data-toggle="collapse" data-target="#statsRow">[ Show/Hide ]</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row collapse show" id="statsRow">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Original Gravity</dt>
|
<dt>Original Gravity</dt>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue