Flask (Python) - Stylesheet url_for code for image in a parallel folder Flask (Python) - Stylesheet url_for code for image in a parallel folder flask flask

Flask (Python) - Stylesheet url_for code for image in a parallel folder


You are already in static when you're in the CSS file. So why not write the path directly:

body {  background-image: url('/static/images/bckgrnd.jpg');}

You should also try url({{ url_for('static', filename='images/bckgrnd.jpg') }});. Notice the missing forward slash in front of images. If that doesn't work it means Jinja is used only on the file that's used as input in flask's render_template.