Problems With Jinja2: Templatenotfound: Index.html
Solution 1:
Try to use
loader=jinja2.FileSystemLoader('templates')
instead of
loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates'))
It works for me.
Solution 2:
This solved it for me:
mkdir templates
echo"hello world" > templates/index.html
Solution 3:
Well, my error was simple and silly. I have create the file "index.html" the wrong way (here the right way). So, my "index.html" file was indeed a ".text" file (because I just rename it to "index.html" instead of "save as" index.html"). Thanks for the help, guys!
Solution 4:
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),autoescape = True)
Solution 5:
Two thoughts based on getting my first GAE effort with Jinja2 to work. First, in your yaml file, you have "-url: ." though I used "-url: /." based on tutorials I saw. However, this may be irrelevant to your issue. Second, I used the guidance on this page for how I established my Jinja2 renderer and had no issue with the template being found in the templates subdirectory of the application directory: http://webapp-improved.appspot.com/api/webapp2_extras/jinja2.html#module-webapp2_extras.jinja2
Post a Comment for "Problems With Jinja2: Templatenotfound: Index.html"