jinja2 template file not found

Hi.  I am having trouble getting PyCharm to `find` my jinja2 templates.  This causes a lot of unnecessary warnings in my source code; and they're driving me crazy :D

To produce my problem I create a new `Flask` project in pycharm.

Which creates this directory structure:

  static      <dir>
  templates   <dir>

Next, I add a simple template `index.html` to the templates directory.

Then I modify the test.py script:

from flask import Flask, render_template

app = Flask(__name__)

def hello_world():
    return render_template('/index.html')

Finally, I mark the templates directory as a template directory.  However, the render_template(...) line issues this warning:

Template file 'index.html' not  found

Any idea what I'm doing wrong?


Please sign in to leave a comment.