from flask import Flask, request, render_template, url_for
app = Flask(__name__)
@app.route("/")
def main():
return render_template('main.html')
@app.route("/other")
def other():
return render_template('other.html',
img_path = url_for('static', filename='img/python.png'))
<h1>Main page</h1>
<img src="/static/img/python.png">
<p>
<a href="/other">other</a>
<h2>Other page</h2>
img_path: {{ img_path }}
<p>
<img src="{{ img_path }}">
<p>
<a href="/">main</a>
.
├── app.py
├── static
│ └── img
│ └── python.png
└── templates
├── main.html
└── other.html