title: Flask template not found even when file exists and templates folder is called 'templates'?
body: <p>As the title says, I have problems to render a template which exists in the correct folder which is supposed to have the correct name:</p>
  
  <pre><code>flaskapp/
       app.py
       /templates
          website.html
  </code></pre>
  
  <p>and the usual code</p>
  
  <pre><code> from flask import Flask, render_template
   app = Flask(__name__)
  
   @app.route("/")
   def main():
       return render_template('website.html')
  
   if __name__ == '__main__':
       app.run()`
  </code></pre>
  
  <p>which yields the error <code>TemplateNotFound: website.html</code>  </p>
  
  <p>As the answers of <a href="https://stackoverflow.com/questions/33396064/flask-template-not-found">this question</a> and <a href="https://stackoverflow.com/questions/23327293/flask-raises-templatenotfound-error-even-though-template-file-exists">this other question</a> suggest, the problem is either the location of the html file or the name of the templates folder, however in my case I don't have these problems.</p>
  
  <p>Now it's important to say that in fact, a few weeks ago I was able to render my template without any problem, with exactly the same <code>app.py</code> file, the same <code>website.html</code> file and the same location. </p>
  
  <p>However, I created a copy of <code>app.py</code>, say <code>app1.py</code>, another route similar to <code>flaskapp</code>, say <code>flaskapp1</code> and some other small modifications (which I don't remember at this moment) because I wanted to do some tests in the <code>app1.py</code> file without modifying my original <code>app.py</code> but this is when the <code>TemplateNotFound</code>error started to arise. Then I deleted the route <code>flaskapp1</code>, the file <code>app1.py</code> and leave everything exactly as it was before creating duplicates but I can't get rid of the <code>TemplateNotFound</code> error now. </p>
  
  <p>And now it's been 3 weeks trying to solve this issue without success. So any help will be appreciated.</p>
  
  <p><strong>EDIT</strong>: I created a new folder <code>test</code> with a python file <code>app1.py</code>. Next to the python file I created the folder <code>templates</code>which contains a html file <code>website1.html</code>.</p>
  
  <p>This is the <code>website1.html</code> file:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt; Hello! &lt;/head&gt;
  &lt;body&gt; 
  &lt;p&gt; How are you? &lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is the <code>app1.py</code> file:</p>
  
  <pre><code>from flask import Flask, render_template
  
  app1=Flask(__name__)
  
  @app1.route("/")
  def main():
      return render_template("website1.html")
  
  if __name__ == "__main__":
      app1.run()
  </code></pre>
  
  <p>This is the route:</p>
  
  <pre><code>    test/
       app1.py
       /templates
          website1.html
  </code></pre>
  
  <p>The folder <code>test</code> is located at <code>C:\Users\Alcatraz\Documents</code></p>
  
  <p>and when I run the <code>app1.py</code> file I get the following error: </p>
  
  <pre><code>[2017-11-04 21:04:55,176] ERROR in app: Exception on / [GET]
  Traceback (most recent call last):
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\app.py", line 1988, in wsgi_app
  response = self.full_dispatch_request()
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\app.py", line 1641, in full_dispatch_request
  rv = self.handle_user_exception(e)
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\app.py", line 1544, in handle_user_exception
  reraise(exc_type, exc_value, tb)
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\app.py", line 1639, in full_dispatch_request
  rv = self.dispatch_request()
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\app.py", line 1625, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
  File "&lt;ipython-input-10-773353175e19&gt;", line 7, in main
  return render_template("website1.html")
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\templating.py", line 133, in render_template
  return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\jinja2\environment.py", line 851, in get_or_select_template
  return self.get_template(template_name_or_list, parent, globals)
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\jinja2\environment.py", line 812, in get_template
  return self._load_template(name, self.make_globals(globals))
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\jinja2\environment.py", line 774, in _load_template
  cache_key = self.loader.get_source(self, name)[1]
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\templating.py", line 57, in get_source
  return self._get_source_fast(environment, template)
  File "C:\Users\Alcatraz\Anaconda2\lib\site-packages\flask\templating.py", line 85, in _get_source_fast
  raise TemplateNotFound(template)
  TemplateNotFound: website1.html
  </code></pre>