diff --git a/FlaskWebProject/FlaskWebProject/__init__.py b/FlaskWebProject/FlaskWebProject/__init__.py index a67f3f8..e416d79 100644 --- a/FlaskWebProject/FlaskWebProject/__init__.py +++ b/FlaskWebProject/FlaskWebProject/__init__.py @@ -1,4 +1,5 @@ from flask import Flask, render_template +from .lewy_globals import * app = Flask(__name__) @@ -11,15 +12,16 @@ def index(): 'matches_list': [ {'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90}, {'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85}, - # Mo¿esz dodaæ wiêcej meczów... + # Możesz dodać wiÄ™cej meczów... ] } return render_template('index.html', goals=stats['goals'], assists=stats['assists'], - matches=stats['matches'], matches_list=stats['matches_list']) + matches=stats['matches'], matches_list=stats['matches_list'], + commit=lewy_globals.getCommit()) @app.route('/mecze') def mecze(): - # Mo¿esz dostarczyæ szczegó³y dotycz¹ce meczów + # Możesz dostarczyć szczegóły dotyczÄ…ce meczów matches = [ {'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90}, {'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85}, @@ -36,4 +38,4 @@ def statystyki(): return render_template('stats.html', stats=stats) if __name__ == '__main__': - app.run(debug=True) + app.run(debug=True) \ No newline at end of file diff --git a/FlaskWebProject/FlaskWebProject/lewy_globals.py b/FlaskWebProject/FlaskWebProject/lewy_globals.py new file mode 100644 index 0000000..85b244f --- /dev/null +++ b/FlaskWebProject/FlaskWebProject/lewy_globals.py @@ -0,0 +1,10 @@ +from git import Repo # hash ostatniego commitu + +def getCommit(): + repo = "

Brak informacji o wersji skryptu

" + try: + repo = Repo(search_parent_directories=True).head.object.hexsha + repo = f"

Commit: {repo[:11]}

" + except: + pass + return repo \ No newline at end of file diff --git a/FlaskWebProject/FlaskWebProject/templates/base.html b/FlaskWebProject/FlaskWebProject/templates/base.html index 4dafe8a..92c8668 100644 --- a/FlaskWebProject/FlaskWebProject/templates/base.html +++ b/FlaskWebProject/FlaskWebProject/templates/base.html @@ -47,5 +47,10 @@ } } + + +
+ {% block footer %}{% endblock %} + diff --git a/FlaskWebProject/FlaskWebProject/templates/index.html b/FlaskWebProject/FlaskWebProject/templates/index.html index 3fcd49b..8914e51 100644 --- a/FlaskWebProject/FlaskWebProject/templates/index.html +++ b/FlaskWebProject/FlaskWebProject/templates/index.html @@ -12,3 +12,7 @@

Liczba meczów: {{ matches }}

{% endblock %} + +{% block footer %} +{{ commit | safe }} +{% endblock %} \ No newline at end of file diff --git a/FlaskWebProject/requirements.txt b/FlaskWebProject/requirements.txt index f93353a..1957bd7 100644 --- a/FlaskWebProject/requirements.txt +++ b/FlaskWebProject/requirements.txt @@ -1 +1,2 @@ Flask>=2.2.3 +gitpython