This commit is contained in:
Pc
2025-04-08 22:51:31 +02:00
parent acb68496fd
commit 29f6186e8c
10 changed files with 150 additions and 242 deletions

View File

@@ -30,7 +30,6 @@
<ItemGroup>
<Compile Include="runserver.py" />
<Compile Include="FlaskWebProject\__init__.py" />
<Compile Include="FlaskWebProject\views.py" />
</ItemGroup>
<ItemGroup>
<Folder Include="FlaskWebProject\" />
@@ -41,6 +40,11 @@
<Folder Include="FlaskWebProject\templates\" />
</ItemGroup>
<ItemGroup>
<Content Include="FlaskWebProject\static\script.js" />
<Content Include="FlaskWebProject\static\style.css" />
<Content Include="FlaskWebProject\templates\base.html" />
<Content Include="FlaskWebProject\templates\matches.html" />
<Content Include="FlaskWebProject\templates\stats.html" />
<Content Include="requirements.txt" />
<Content Include="FlaskWebProject\static\content\bootstrap.css" />
<Content Include="FlaskWebProject\static\content\bootstrap.min.css" />
@@ -64,10 +68,7 @@
<Content Include="FlaskWebProject\static\scripts\respond.js" />
<Content Include="FlaskWebProject\static\scripts\respond.min.js" />
<Content Include="FlaskWebProject\static\scripts\_references.js" />
<Content Include="FlaskWebProject\templates\about.html" />
<Content Include="FlaskWebProject\templates\contact.html" />
<Content Include="FlaskWebProject\templates\index.html" />
<Content Include="FlaskWebProject\templates\layout.html" />
</ItemGroup>
<ItemGroup>
<Interpreter Include="env\">

View File

@@ -1,8 +1,39 @@
"""
The flask application package.
"""
from flask import Flask, render_template
from flask import Flask
app = Flask(__name__)
import FlaskWebProject.views
@app.route('/')
def index():
stats = {
'goals': 38,
'assists': 12,
'matches': 45,
'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<4D>esz doda<64> wi<77>cej mecz<63>w...
]
}
return render_template('index.html', goals=stats['goals'], assists=stats['assists'],
matches=stats['matches'], matches_list=stats['matches_list'])
@app.route('/mecze')
def mecze():
# Mo<4D>esz dostarczy<7A> szczeg<65><67>y dotycz<63>ce mecz<63>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},
]
return render_template('matches.html', matches=matches)
@app.route('/statystyki')
def statystyki():
stats = {
'goals': 38,
'assists': 12,
'matches': 45,
}
return render_template('stats.html', stats=stats)
if __name__ == '__main__':
app.run(debug=True)

View File

@@ -1,4 +1,5 @@
body {
/* Podstawowy styl */
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
@@ -47,16 +48,93 @@ th, td {
margin: 20px auto;
}
/* Dark Mode */
/* Styl dla trybu ciemnego */
body.dark-mode {
background-color: #121212;
color: white;
}
body.dark-mode nav {
background: #333;
}
body.dark-mode table {
background: #121212;
color: #e0e0e0;
}
body.dark-mode nav {
background: #333;
}
body.dark-mode table {
color: #e0e0e0;
}
body.dark-mode h1 {
color: #eaeaea;
}
body.dark-mode header button {
background-color: #444;
color: #eaeaea;
}
body.dark-mode header button:hover {
background-color: #666;
}
body.dark-mode ul li {
background-color: #333;
}
body.dark-mode ul li:hover {
background-color: #444;
}
/* Dodatkowe style */
body.dark-mode h1 {
color: #eaeaea;
}
body.dark-mode header button {
background-color: #444;
color: #eaeaea;
}
body.dark-mode header button:hover {
background-color: #666;
}
body.dark-mode ul li {
background-color: #333;
}
body.dark-mode ul li:hover {
background-color: #444;
}
/* Przyciski i elementy */
header button {
padding: 10px 15px;
border: none;
background-color: #007bff;
color: white;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
header button:hover {
background-color: #0056b3;
}
/* Style dla listy meczów */
ul {
list-style: none;
padding: 0;
}
ul li {
background-color: #eaeaea;
margin-bottom: 10px;
padding: 10px;
border-radius: 5px;
transition: background-color 0.3s;
}
ul li:hover {
background-color: #d1d1d1;
}

View File

@@ -1,10 +0,0 @@
{% extends "layout.html" %}
{% block content %}
<h2>{{ title }}.</h2>
<h3>{{ message }}</h3>
<p>Use this area to provide additional information.</p>
{% endblock %}

View File

@@ -1,20 +0,0 @@
{% extends "layout.html" %}
{% block content %}
<h2>{{ title }}.</h2>
<h3>{{ message }}</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>
{% endblock %}

View File

@@ -1,33 +1,14 @@
{% extends "layout.html" %}
{% extends "base.html" %}
{% block title %}Strona Główna{% endblock %}
{% block content %}
<div class="jumbotron">
<h1>Flask</h1>
<p class="lead">Flask is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://flask.pocoo.org/" class="btn btn-primary btn-large">Learn more &raquo;</a></p>
<h2>Witaj na stronie poświęconej statystykom Roberta Lewandowskiego!</h2>
<p>Tu znajdziesz najnowsze informacje o meczach, golach, asystach i innych statystykach.</p>
<div>
<h3>Ogólne statystyki:</h3>
<p>Gole: {{ goals }}</p>
<p>Asysty: {{ assists }}</p>
<p>Liczba meczów: {{ matches }}</p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
Flask gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://flask.pocoo.org/docs/">Learn more &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>The Python Package Index is a repository of software for the Python programming language.</p>
<p><a class="btn btn-default" href="https://pypi.python.org/pypi">Learn more &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Microsoft Azure</h2>
<p>You can easily publish to Microsoft Azure using Visual Studio. Find out how you can host your application using a free trial today.</p>
<p><a class="btn btn-default" href="http://azure.microsoft.com">Learn more &raquo;</a></p>
</div>
</div>
{% endblock %}

View File

@@ -1,118 +0,0 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>Statystyki Roberta Lewandowskiego</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 20px;
}
.container {
max-width: 960px;
margin: auto;
background-color: white;
padding: 30px;
border-radius: 15px;
box-shadow: 0 0 15px rgba(0,0,0,0.1);
}
h1 {
text-align: center;
color: #d32f2f;
}
.profile {
text-align: center;
}
.profile img {
border-radius: 50%;
width: 180px;
height: 180px;
object-fit: cover;
}
.stats {
display: flex;
justify-content: space-around;
margin-top: 20px;
}
.stat {
text-align: center;
}
.stat h2 {
color: #333;
margin: 5px 0;
}
table {
width: 100%;
margin-top: 30px;
border-collapse: collapse;
}
th, td {
padding: 12px;
border-bottom: 1px solid #ccc;
text-align: center;
}
th {
background-color: #e53935;
color: white;
}
</style>
</head>
<body>
<div class="container">
<h1>Statystyki Roberta Lewandowskiego</h1>
<div class="profile">
<img src="{{ url_for('static', filename='lewandowski.jpg') }}" alt="Robert Lewandowski">
<p><strong>Napastnik</strong> - FC Barcelona / Polska Reprezentacja</p>
</div>
<div class="stats">
<div class="stat">
<h2>{{ goals }}</h2>
<p>Gole</p>
</div>
<div class="stat">
<h2>{{ assists }}</h2>
<p>Asysty</p>
</div>
<div class="stat">
<h2>{{ matches }}</h2>
<p>Mecze</p>
</div>
</div>
<h2 style="margin-top: 40px;">Szczegóły Meczy</h2>
<table>
<tr>
<th>Data</th>
<th>Przeciwnik</th>
<th>Gole</th>
<th>Asysty</th>
<th>Minuty</th>
</tr>
{% for match in matches %}
<tr>
<td>{{ match.date }}</td>
<td>{{ match.opponent }}</td>
<td>{{ match.goals }}</td>
<td>{{ match.assists }}</td>
<td>{{ match.minutes }}</td>
</tr>
{% endfor %}
</table>
</div>
</body>
</html>

View File

@@ -1,7 +1,9 @@
{% extends 'base.html' %}
{% block title %}Historia meczów{% endblock %}
{% block title %}Lista meczów{% endblock %}
{% block content %}
<h2>Historia ostatnich meczów</h2>
<h2>📅 Mecze Roberta</h2>
<table>
<tr>
<th>Data</th>

View File

@@ -3,10 +3,10 @@
{% block title %}Statystyki{% endblock %}
{% block content %}
<h2>Statystyki Roberta Lewandowskiego</h2>
<ul>
<li>Gole: {{ stats.goals }}</li>
<li>Asysty: {{ stats.assists }}</li>
<li>Mecze: {{ stats.matches }}</li>
</ul>
<h2>Statystyki Roberta Lewandowskiego</h2>
<ul>
<li>Gole: {{ stats.goals }}</li>
<li>Asysty: {{ stats.assists }}</li>
<li>Mecze: {{ stats.matches }}</li>
</ul>
{% endblock %}

View File

@@ -1,37 +0,0 @@
"""
Routes and views for the flask application.
"""
from datetime import datetime
from flask import render_template
from FlaskWebProject import app
@app.route('/')
@app.route('/home')
def home():
"""Renders the home page."""
return render_template(
'index.html',
title='Home Page',
year=datetime.now().year,
)
@app.route('/contact')
def contact():
"""Renders the contact page."""
return render_template(
'contact.html',
title='Contact',
year=datetime.now().year,
message='Your contact page.'
)
@app.route('/about')
def about():
"""Renders the about page."""
return render_template(
'about.html',
title='About',
year=datetime.now().year,
message='Your application description page.'
)