我正在使用flask構建網站,我想要讓html可以引用css,f12確定有看到css,但是p依然沒有效果
嘗試過修改link的href但還是沒甚麼用,以下為我的專案文件夾
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小遊戲</title>
<!-- <link rel="stylesheet" type="text/css" href="123.css"> -->
<link href="D:\python\flask\static\123.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>123</p>
</body>
</html>
body {
/* margin: auto;
max-width: 580px;
font-size: 14px;
font-family: Helvetica, Arial, sans-serif; */
background-image: url('https://cf.shopee.tw/file/423d7783def285e44a156b93a37a9813');
}
p{
color: red;
}
from flask import Flask, request, render_template
# pythonCopy codeimport os
# app = Flask(__name__, static_folder="public", static_url_path="/", template_folder=os.getcwd())
app = Flask(__name__, static_folder="public", static_url_path="/")
# 處理路徑 / 的對應函市
@app.route("/")
def index():
return render_template("123.html")
app.run()