aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/misc_views.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-25 17:06:02 -0500
committerFrederick Muriuki Muriithi2024-07-31 09:30:26 -0500
commit8bf4ab2832cabc68aed97ae4f08daac3a2c3fe40 (patch)
treee634848d787f68885baa343fd611a9eed55b1c66 /gn_auth/misc_views.py
parent104cf1f238815685582b48e62b0bcd538090ae5f (diff)
downloadgn-auth-8bf4ab2832cabc68aed97ae4f08daac3a2c3fe40.tar.gz
Add endpoint for favicon.ico
Helps with silencing NotFound errors in the logs.
Diffstat (limited to 'gn_auth/misc_views.py')
-rw-r--r--gn_auth/misc_views.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/gn_auth/misc_views.py b/gn_auth/misc_views.py
index bd2ad62..2abad4a 100644
--- a/gn_auth/misc_views.py
+++ b/gn_auth/misc_views.py
@@ -2,9 +2,10 @@
Miscellaneous top-level views that have nothing to do with the application's
functionality.
"""
+import os
from pathlib import Path
-from flask import Blueprint
+from flask import Blueprint, current_app as app, send_from_directory
misc = Blueprint("misc", __name__)
@@ -16,3 +17,11 @@ def version():
with open(version_file, encoding="utf-8") as verfl:
return verfl.read().strip()
return "0.0.0"
+
+
+@misc.route("/favicon.ico", methods=["GET"])
+def favicon():
+ """Return the favicon."""
+ return send_from_directory(os.path.join(app.root_path, "static"),
+ "images/CITGLogo.png",
+ mimetype="image/png")