background image 404 not found error python flask
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I’m trying to show a background image using python flask and html. But I get the error “Failed to load resource: the server responded with a status of 404 (NOT FOUND)” My structre I think is good but heres the code.
home.py file
from flask import render_template, Blueprint, request, send_file
home_page = Blueprint(‘home’, __name__)
@home_page.route(‘/’, methods=[‘POST’, ‘GET’])
def home():
return render_template(‘index.html’)
return send_file (“home_bg.jpg”)
index.html file
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>poo</title>
<style>
</style>
</head>
<body style=”background-image: url(/static/home_bg.jpg);”>
<script>
</script>
</body>
</html>
I think it has something to do with returning the picture to the client in the home.py file.
أضف إجابة