feat: show commit info in footer
This commit is contained in:
@@ -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<EFBFBD>esz doda<EFBFBD> wi<EFBFBD>cej mecz<EFBFBD>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<EFBFBD>esz dostarczy<EFBFBD> szczeg<EFBFBD><EFBFBD>y dotycz<EFBFBD>ce mecz<EFBFBD>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)
|
||||
10
FlaskWebProject/FlaskWebProject/lewy_globals.py
Normal file
10
FlaskWebProject/FlaskWebProject/lewy_globals.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from git import Repo # hash ostatniego commitu
|
||||
|
||||
def getCommit():
|
||||
repo = "<p>Brak informacji o wersji skryptu</p>"
|
||||
try:
|
||||
repo = Repo(search_parent_directories=True).head.object.hexsha
|
||||
repo = f"<p>Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{repo}' style='width: 50%'>{repo[:11]}</a></p>"
|
||||
except:
|
||||
pass
|
||||
return repo
|
||||
@@ -38,5 +38,10 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--!>Footer<-->
|
||||
<hr/>
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -12,3 +12,7 @@
|
||||
<p>Liczba meczów: {{ matches }}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{{ commit | safe }}
|
||||
{% endblock %}
|
||||
@@ -1 +1,2 @@
|
||||
Flask>=2.2.3
|
||||
gitpython
|
||||
|
||||
Reference in New Issue
Block a user