I'm new to flask (but not new to Python) and I've been following Corey Schafer's YouTube tutorial on setting things up. I've done everything almost as Corey did in the videos. I'm working with Visual Studio Code on Mac instead of Sublime, which is the only difference.
When I get to the step of using the render_template
function to execute basic html files, something is going wrong and I'm getting all kinds of errors. What am I missing?
My flask_blog.py program:
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
@app.route("/home")
def home():
return render_template('home.html')
@app.route("/about")
def about():
return render_template('about.html')
if __name__ == '__main__':
app.run(debug=True)
home.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Home Page</h1>
</body>
</html>
about.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>About Page</h1>
</body>
</html>
And here is what I'm getting when I try navigating to the home page: Screenshot 1/2