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:
@@ -2,6 +2,7 @@
|
|||||||
WEB_APP_PORT=5000
|
WEB_APP_PORT=5000
|
||||||
|
|
||||||
# Application configuration
|
# Application configuration
|
||||||
|
PROJECT_VERSION=3.1.2
|
||||||
MAX_CONTENT_LENGTH=3145728
|
MAX_CONTENT_LENGTH=3145728
|
||||||
MAX_PENDING_TIME=600
|
MAX_PENDING_TIME=600
|
||||||
MAX_STORE_TIME=259200
|
MAX_STORE_TIME=259200
|
||||||
|
|||||||
+8
-1
@@ -36,6 +36,7 @@ def create_app() -> Flask:
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.json.sort_keys = False # type: ignore
|
app.json.sort_keys = False # type: ignore
|
||||||
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DB_URI")
|
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["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||||
app.config["MAX_CONTENT_LENGTH"] = int(os.environ.get("MAX_CONTENT_LENGTH", 1024 * 1024))
|
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))
|
app.config["REDIS_QUEUE"] = Queue(connection=Redis(host="redis", port=6379))
|
||||||
@@ -426,7 +427,13 @@ def create_app() -> Flask:
|
|||||||
return abort(404, description="Image not found or unsupported format")
|
return abort(404, description="Image not found or unsupported format")
|
||||||
|
|
||||||
return send_file(output_file, as_attachment=True)
|
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
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<a class="title_link" href="/">
|
<a class="title_link" href="/">
|
||||||
<img src="/static/img/logo.svg" alt="logo" id="water-logo"/>
|
<img src="/static/img/logo.svg" alt="logo" id="water-logo"/>
|
||||||
<span class="title-text"> Aperi'Solve </span>
|
<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>
|
<br><br>
|
||||||
</a>
|
</a>
|
||||||
{% block body_content %} {% endblock %}
|
{% block body_content %} {% endblock %}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<a class="title-link-footer" href="/">
|
<a class="title-link-footer" href="/">
|
||||||
<span class="title-text-footer">Aperi'Solve</span>
|
<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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user