diff options
author | 2018-02-04 09:28:37 +0100 | |
---|---|---|
committer | 2018-02-04 09:28:37 +0100 | |
commit | a93c70bbf0dce84f0f9276fb8f19b9fe8d479ac2 (patch) | |
tree | dd910a187e4f6abbdc62cb025482997f73bebdae | |
parent | Add /invite route (diff) | |
parent | Merge branch 'master' into route-404-and-healthcheck (diff) |
Merge pull request #2 from discord-python/route-404-and-healthcheck
adds a catchall for 404 and a healthcheck route
-rw-r--r-- | app.py | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -4,7 +4,9 @@ import os # Snekchek -from flask import Flask, redirect +from flask import Flask +from flask import jsonify +from flask import redirect app = Flask(__name__) @@ -19,5 +21,15 @@ def _index(): def _invite(): return redirect("https://invite.pythondiscord.com/") [email protected]("/healthcheck") +def _healthcheck(): + return jsonify({"status":"ok"}) + + [email protected](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) |