From 0feecc7a767c90b03b63d9d81b79c176947c6207 Mon Sep 17 00:00:00 2001 From: Nick Janetakis Date: Fri, 15 Nov 2024 08:13:49 -0500 Subject: [PATCH] Get Flask version from metadata This fixes the __version__ deprecation warning. --- CHANGELOG.md | 2 ++ hello/page/views.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b63e17..87ab761 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed +- Get Flask version in `hello/page/views.py` with metadata instead of `__version__` + #### Languages and services - Update `Python` to `3.13.0` diff --git a/hello/page/views.py b/hello/page/views.py index 3bbaece..6b2b65d 100644 --- a/hello/page/views.py +++ b/hello/page/views.py @@ -1,7 +1,7 @@ import os +from importlib.metadata import version from flask import Blueprint -from flask import __version__ from flask import render_template from config.settings import DEBUG @@ -13,7 +13,7 @@ def home(): return render_template( "page/home.html", - flask_ver=__version__, + flask_ver=version("flask"), python_ver=os.environ["PYTHON_VERSION"], debug=DEBUG, )