Python Flask Basics Templates and Static Files Simple Template

templates/html

help

flask_app.py
from flask import Flask
from flask import render_template

app = Flask(__name__)


@app.route('/hello/<name>')
def hello(name="Treehouse"):
    return  render_template('Hello.html', name=name)
templates/hello.html
<!doctype html>
<html>
  <head><title>Hello!</title></head>
<body>
  <h1>Howdy!</h1>
</body>
</html>

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

You need to render the correct template (Hello.html isn't the same as hello.html) and you need to print out the name variable inside the <h1> tag.

thanx kenneth