From 8bf4ab2832cabc68aed97ae4f08daac3a2c3fe40 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 25 Jul 2024 17:06:02 -0500 Subject: Add endpoint for favicon.ico Helps with silencing NotFound errors in the logs. --- gn_auth/misc_views.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gn_auth') 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") -- cgit v1.2.3