TIL Python Basics Day 56 - Rendering HTML/Static files and Using Website Templates
Rendering HTML templates
make a seperate directory 'templates'
Store index.html file,
and return render_template('index.html') in server.py
from flask import render_template
@app.route('/')
def home():
return render_template('index.html')
if downloaded html file from web, it might be .htm -> change it to .htmlStatic files and Using Website Templates
static files needs to be inside static folder
static files: css, image, video files
1. image
specify directory in <td><img src="static/angela.png" alt="angela profile picture"></td>
2. css
create a css file in static file
main.css
body {
background-color: purple
}
Link relationship to html at head partindex.html
<link rel="stylesheet" href="{{ url_for('static', filename='main.css') }}">
Note: browsers like to cache -> on the same day, it won't change over one day. solution: hard reload -> shift + refresh button
キャッシュ
Webキャッシュは、一般的なドキュメントのコピーを自動的に保持するためのHTTPデバイスです.
Prebuilt Templates
https://html5up.net/
Change the directories accordingly -> ctrl + R for mass change
module 461 for Chrome developer tools for modifying on screen. After editing save the html and add it to your file.
Project. Digital Name Card
img {
width: 100%;
height: auto;
}
I marked 70% progress in the online lecture. I've been studying for 60 days by myself. I've started it since January with 100 days challenge. My daily routine is very stable/uniform(is there any better expression for this?) I wake up around 8am and study till noon. Except for lunch, dinner and brief breaks, I try to focus on studying. It's not difficult with help of challengers application and time recording application. Since it's winter time now, It's perfect to stay in and focus on studying. I hope I can enjoy outdoor activities and socialising by this summer!
Reference
この問題について(TIL Python Basics Day 56 - Rendering HTML/Static files and Using Website Templates), 我々は、より多くの情報をここで見つけました https://velog.io/@daylee/TIL-Python-Basics-Day-56-Rendering-HTMLStatic-files-and-Using-Website-Templatesテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol