Update main.py and history.html; add new templates
This commit is contained in:
69
templates/forecast.html
Normal file
69
templates/forecast.html
Normal file
@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Prognoza pogody - {{ city }}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #eef2f3;
|
||||
color: #333;
|
||||
margin: 20px;
|
||||
}
|
||||
h1 {
|
||||
color: #2a6ebb;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 60%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #aaa;
|
||||
padding: 8px 12px;
|
||||
text-align: center;
|
||||
}
|
||||
th {
|
||||
background-color: #2a6ebb;
|
||||
color: #fff;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #d9e1ec;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Prognoza pogody dla {{ city }}</h1>
|
||||
|
||||
{% if error %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% elif forecast and forecast.time %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Temperatura maks. (°C)</th>
|
||||
<th>Temperatura min. (°C)</th>
|
||||
<th>Opady (mm)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in range(forecast.time|length) %}
|
||||
<tr>
|
||||
<td>{{ forecast.time[i] }}</td>
|
||||
<td>{{ forecast.temperature_2m_max[i] }}</td>
|
||||
<td>{{ forecast.temperature_2m_min[i] }}</td>
|
||||
<td>{{ forecast.precipitation_sum[i] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>Brak danych pogodowych.</p>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
@ -1,15 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<title>Historia pogody - {{ city }}</title>
|
||||
<meta charset="UTF-8">
|
||||
<title>Historia zapytan o {{ city }}</title>
|
||||
<style>
|
||||
body { font-family: Arial; padding: 20px; }
|
||||
table { border-collapse: collapse; width: 100%; }
|
||||
th, td { padding: 10px; border: 1px solid #ddd; text-align: left; }
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #eef2f3;
|
||||
color: #333;
|
||||
margin: 20px;
|
||||
}
|
||||
h1 {
|
||||
color: #2a6ebb;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 60%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #aaa;
|
||||
padding: 8px 12px;
|
||||
text-align: center;
|
||||
}
|
||||
th {
|
||||
background-color: #2a6ebb;
|
||||
color: #fff;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #d9e1ec;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Historia pogody – {{ city }}</h2>
|
||||
<h1>Historia zapytan o {{ city }}</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
|
67
templates/history_range.html
Normal file
67
templates/history_range.html
Normal file
@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Historia pogody - {{ city }}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #eef2f3;
|
||||
color: #333;
|
||||
margin: 20px;
|
||||
}
|
||||
h1 {
|
||||
color: #2a6ebb;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 80%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #aaa;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
th {
|
||||
background-color: #2a6ebb;
|
||||
color: #fff;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #d9e1ec;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Historia pogody dla {{ city }} <br> od {{ start_date }} do {{ end_date }}</h1>
|
||||
|
||||
{% if error %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% elif history %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Temp. maks. (°C)</th>
|
||||
<th>Temp. min. (°C)</th>
|
||||
<th>Opady (mm)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in range(history["time"]|length) %}
|
||||
<tr>
|
||||
<td>{{ history["time"][i] }}</td>
|
||||
<td>{{ history["temperature_2m_max"][i] }}</td>
|
||||
<td>{{ history["temperature_2m_min"][i] }}</td>
|
||||
<td>{{ history["precipitation_sum"][i] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
67
templates/hourly_forecast.html
Normal file
67
templates/hourly_forecast.html
Normal file
@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Prognoza godzinowa - {{ city }}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #eef2f3;
|
||||
color: #333;
|
||||
margin: 20px;
|
||||
}
|
||||
h1 {
|
||||
color: #2a6ebb;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 80%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #aaa;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
th {
|
||||
background-color: #2a6ebb;
|
||||
color: #fff;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #d9e1ec;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Prognoza godzinowa dla {{ city }}</h1>
|
||||
|
||||
{% if error %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% elif hourly_forecast %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Godzina</th>
|
||||
<th>Temp. (°C)</th>
|
||||
<th>Wiatr (km/h)</th>
|
||||
<th>Opady (mm)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in range(hourly_forecast["time"]|length) %}
|
||||
<tr>
|
||||
<td>{{ hourly_forecast["time"][i] }}</td>
|
||||
<td>{{ hourly_forecast["temperature_2m"][i] }}</td>
|
||||
<td>{{ hourly_forecast["windspeed_10m"][i] }}</td>
|
||||
<td>{{ hourly_forecast["precipitation"][i] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
11
templates/ping.html
Normal file
11
templates/ping.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Ping status</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Status: OK</h1>
|
||||
<p>Serwer działa poprawnie.</p>
|
||||
</body>
|
||||
</html>
|
28
templates/test.html
Normal file
28
templates/test.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Historia pogody - {{ city }}</title>
|
||||
<style>
|
||||
body { font-family: Arial; padding: 20px; }
|
||||
table { border-collapse: collapse; width: 100%; }
|
||||
th, td { padding: 10px; border: 1px solid #ddd; text-align: left; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Historia pogody – {{ city }}</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Data</th>
|
||||
<th>Temperatura (°C)</th>
|
||||
<th>Wiatr (m/s)</th>
|
||||
</tr>
|
||||
{% for r in records %}
|
||||
<tr>
|
||||
<td>{{ r.time.strftime('%Y-%m-%d %H:%M') }}</td>
|
||||
<td>{{ r.temperature }}</td>
|
||||
<td>{{ r.windspeed }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user