Arka plan resmim sadece @ app.route ('/') içeren bu şablon için geçerlidir.Flask Şablonlarında arka plan görüntüsü nasıl ayarlanır?
@app.route('/')
def home():
return render_template('post.html')
Her şey çalışır:
<header class="intro-header" style="background-image: url('static/img/home.jpg')">
Bu zaman mükemmel çalışıyor. Ben bu olsun:
127.0.0.1 - - [19/Sep/2016 21:07:11] "GET /static/img/home.jpg HTTP/1.1" 304
Ama aynı şablonu kullanırken:
127.0.0.1 - - [19/Sep/2016 21:15:23] "GET /post/static/img/home.jpg HTTP/1.1" 404 -
Ve background-image boştur:
@app.route('/post/')
def post():
return render_template('post.html')
Ben bu olsun.
Siteye göreli bağlantı verin: 'url (/ static/...)' – hjpotter92