# HG changeset patch # User Paul Fisher # Date 1569803568 14400 # Node ID d54155a199d8daef6451a1c52640847b200e8886 # Parent 4c25d5bb35343a7bb4ed96912538aef76aa9b119 Improve template; add stylesheet. diff -r 4c25d5bb3534 -r d54155a199d8 weather_server/server.py --- a/weather_server/server.py Sun Sep 29 15:23:26 2019 -0400 +++ b/weather_server/server.py Sun Sep 29 20:32:48 2019 -0400 @@ -12,6 +12,7 @@ def build_app(root_directory: str) -> flask.Flask: locs = locations.Locations(root_directory) app = flask.Flask(__name__) + app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 @app.route('/favicon.ico') def favicon(): diff -r 4c25d5bb3534 -r d54155a199d8 weather_server/static/style.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/weather_server/static/style.css Sun Sep 29 20:32:48 2019 -0400 @@ -0,0 +1,90 @@ +html, body { + margin: 0; + padding: 0; + display: flex; + flex-flow: column nowrap; + width: 100%; + height: 100%; + + font-family: Roboto, sans-serif; +} + +h1 { + /* Reset. */ + margin: 0; + padding: 0; + font: inherit; + + flex: none; + background: #263238; + color: white; + height: 48px; + padding: 0 24px; + font-size: 24px; + + display: flex; + flex-direction: column; + justify-content: center; +} + +h1 span { + display: block; +} + +p { + margin: 0; + padding: 0; + font: inherit; + flex: auto; + position: relative; + display: flex; + flex-direction: column; + align-items: baseline; + padding: 24px; +} + +p.important .key { + display: block; + opacity: 75%; + font-size: 18px; +} + +p.important .value { + margin-top: 0; + font-size: 150px; + display: flex; + flex-flow: row nowrap; +} + +p.important .value .unit { + font-size: 33%; + font-weight: bold; + opacity: 66%; + padding-top: 0.4em; +} + +#temp { + background: #0d47a1; + color: white; +} + +#dewpoint { + background: #5472d3; + color: white; +} + +#timestamp { + flex: none; + background: #263238; + color: white; + height: 48px; + padding: 0 24px; + + display: flex; + flex-direction: column; + justify-content: center; +} + +#timestamp > span { + display: block; +} diff -r 4c25d5bb3534 -r d54155a199d8 weather_server/templates/location.html --- a/weather_server/templates/location.html Sun Sep 29 15:23:26 2019 -0400 +++ b/weather_server/templates/location.html Sun Sep 29 20:32:48 2019 -0400 @@ -1,15 +1,43 @@ - Weather for {{ location.name }} + {{ location.name }} + + +

{{ location.name }} conditions

{% if last_reading %} - Temperature: {{ last_reading.temp_f }}
- Dew point: {{ last_reading.dew_point_f }}
- As of: {{ date }} +

+ Temperature + + + + {{- last_reading.temp_f|round|int -}} + + °F + +

+

+ Dew point + + + + {{- last_reading.dew_point_f|round|int -}} + + °F + +

+

+ + Reported + {{ "{:%H:%M}".format(date) }} + +

{% else %} - No weather yet +

?

{% endif %}