feat(template): add version and Current Year via template

- Create python method that returns Current year in json
- footer.html fetch year by {{ year }}
- Add PROJECT_VERSION in .env and .env.example file
- base.html and footer.html fetch current version by {{ config["PROJECT_VERSION"] }}
This commit is contained in:
abneeeees
2026-01-18 02:30:18 +05:30
parent 805731c94b
commit c0f1dd2ad4
4 changed files with 11 additions and 3 deletions
+1
View File
@@ -2,6 +2,7 @@
WEB_APP_PORT=5000
# Application configuration
PROJECT_VERSION=3.1.2
MAX_CONTENT_LENGTH=3145728
MAX_PENDING_TIME=600
MAX_STORE_TIME=259200
+7
View File
@@ -36,6 +36,7 @@ def create_app() -> Flask:
app = Flask(__name__)
app.json.sort_keys = False # type: ignore
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DB_URI")
app.config["PROJECT_VERSION"] = os.getenv("PROJECT_VERSION")
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config["MAX_CONTENT_LENGTH"] = int(os.environ.get("MAX_CONTENT_LENGTH", 1024 * 1024))
app.config["REDIS_QUEUE"] = Queue(connection=Redis(host="redis", port=6379))
@@ -427,6 +428,12 @@ def create_app() -> Flask:
return send_file(output_file, as_attachment=True)
# Returns Current Year
@app.context_processor
def return_curr_year():
year = datetime.today().year
return{"year":year}
return app
+1 -1
View File
@@ -18,7 +18,7 @@
<a class="title_link" href="/">
<img src="/static/img/logo.svg" alt="logo" id="water-logo"/>
<span class="title-text"> Aperi'Solve </span>
<span class="title-version">v3.1.2</span>
<span class="title-version">(v.{{ config["PROJECT_VERSION"] }})</span>
<br><br>
</a>
{% block body_content %} {% endblock %}
+1 -1
View File
@@ -2,7 +2,7 @@
<div>
<a class="title-link-footer" href="/">
<span class="title-text-footer">Aperi'Solve</span>
<span class="title-version-footer">(v.3.1.2) © 2026</span>
<span class="title-version-footer">(v.{{ config["PROJECT_VERSION"] }}) © {{ year }} </span>
</a>
</div>
<div>