0

I'm tinkering around with Flask to play around with Postgres, and the db stuff is going swimmingly, but vexingly, I cannot get render_template to work. Here are the relevant bits:

app.py

from flask import Flask, render_template
app = Flask(__name__)
@app.route("/test2/")
def test2():
    return render_template('test2.html')
if __name__ == "__main__":
    app.debug = True
    app.run()

The file test2.html is located in the ./templates directory. When I run the app and hit that url I get jinja2.exceptions.TemplateNotFound

So I've looked at this:

Python - Flask: render_template() not found

And it's not particularly enlightening. My templates folder is next to the application in the directory tree. I'm sure it's something dead simple, but I'm not seeing it.

Community
  • 1
  • 1
Katharine Osborne
  • 6,571
  • 6
  • 32
  • 61

1 Answers1

2

Well, I'm a dope. Went to git commit my changes on the command line and saw that the templates directory was in the parent directory. It did not look that way in Finder.

Katharine Osborne
  • 6,571
  • 6
  • 32
  • 61