aboutsummaryrefslogtreecommitdiffstats
path: root/app.py
diff options
context:
space:
mode:
authorGravatar Christopher Baklid <[email protected]>2018-02-04 09:28:37 +0100
committerGravatar GitHub <[email protected]>2018-02-04 09:28:37 +0100
commita93c70bbf0dce84f0f9276fb8f19b9fe8d479ac2 (patch)
treedd910a187e4f6abbdc62cb025482997f73bebdae /app.py
parentAdd /invite route (diff)
parentMerge 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
Diffstat (limited to 'app.py')
-rw-r--r--app.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/app.py b/app.py
index 1e762b5e..575f6568 100644
--- a/app.py
+++ b/app.py
@@ -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"})
+
+
+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)