aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/misc_views.py
blob: 2abad4a807e387c4291232dd44d2123852399634 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Miscellaneous top-level views that have nothing to do with the application's
functionality.
"""
import os
from pathlib import Path

from flask import Blueprint, current_app as app, send_from_directory

misc = Blueprint("misc", __name__)

@misc.route("/version")
def version():
    """Get the application's version information."""
    version_file = Path("VERSION.txt")
    if version_file.exists():
        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")