【发布时间】:2020-01-17 18:38:23
【问题描述】:
这是我的 html 模板 homepage.html in /home/saurabh/flask/templates
<!DOCTYPE>
<html>
<head>
<title>homepage</title>
<style>
body{
background-image:url("/home/saurabh/Pictures/599783.jpg");
background-attachment: fixed;
}
</style>
</head>
<body>
<h1>Welcome to our Homepage</h1>
<h3>We will try to make u happy <strong>YOU</strong></h3>
<nav>
<a href="login.html">LOGIN</a>
<a href="signup.html">SIGNUP</a>
<a href="about.html">ABOUT US</a>
</nav>
</body>
</html>
这是我在/home/saurabh/flask中呈现上述模板的python脚本
from flask import Flask,render_template
app=Flask(__name__)
@app.route('/')
def home():
return render_template("homepage.html")
if __name__=="__main__":
app.run(debug=True)
一切正常,但背景图像。我已经尝试使用静态目录,但没有任何效果。 背景图像没有显示在网络浏览器中??
【问题讨论】:
标签: html css python-3.x flask