From 1b0dd9bcb244c5a5ea55108fb87cf12237044a98 Mon Sep 17 00:00:00 2001 From: Christopher Baklid Date: Sat, 3 Feb 2018 21:55:55 +0100 Subject: adds a catchall for 404 and a healthcheck route --- app.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app.py') diff --git a/app.py b/app.py index 9e9cdc4e..3c3cc828 100644 --- a/app.py +++ b/app.py @@ -5,6 +5,7 @@ import os # Snekchek from flask import Flask +from flask import jsonify app = Flask(__name__) @@ -16,5 +17,15 @@ def _index(): return "Robots are taking over" +@app.route("/healthcheck") +def healthcheck(): + return jsonify({"status":"ok"}) + + +@app.errorhandler(404) +def page_not_found(e): + return "replace me with a template, 404 not found", 404 + + if __name__ == '__main__': app.run(port=int(os.environ.get("WEBPAGE_PORT")), debug=False) -- cgit v1.2.3 From af2bf8060c6eb001e5f452532be98188fcd3a7e6 Mon Sep 17 00:00:00 2001 From: Christopher Baklid Date: Sat, 3 Feb 2018 21:59:47 +0100 Subject: satisfy snekcheck --- app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app.py') diff --git a/app.py b/app.py index 3c3cc828..ce52f216 100644 --- a/app.py +++ b/app.py @@ -18,12 +18,12 @@ def _index(): @app.route("/healthcheck") -def healthcheck(): +def _healthcheck(): return jsonify({"status":"ok"}) @app.errorhandler(404) -def page_not_found(e): +def _page_not_found(e): return "replace me with a template, 404 not found", 404 -- cgit v1.2.3