from flask import Flask, render_template app = Flask(__name__) @app.route("/user/<user_id>") def get_user(user_id): user = None if int(user_id) == 1: user = "kevin durant" return render_template("index.html", user=user) if __name__ == ‘__main__‘: app.run(debug=True) #index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>title</title> </head> <body> {% if user %} hello, you are {{ user }} {% else %} sorry, do not find your name {% endif %} </body> </html>