title: Flask cannot find HTML files in templates folder when run through Gunicorn
body: <p>When I run my Flask application directly with Python (developement mode?) everything works fine, so the templates folder is in the right place. When I run it through Gunicorn, it persistently fails to  find my templates folder and thus the required HTML files. I have tried numerous things, such as changing the <code>template_folder</code> variable, and the path that is passed to <code>render_template()</code> - none have had any impact.</p>
  
  <p>I start gunicorn with <code>gunicorn -b 0.0.0.0:80 wsgi</code> (it still doesn't work without wsgi), and everything launches fine.</p>
  
  <p>Terminal:</p>
  
  <pre><code>root@vps621912:/home/websites/test2# source test2/bin/activate
  (test2) root@vps621912:/home/websites/test2# gunicorn -b 0.0.0.0:80 server:app
  [2018-12-21 18:13:55 +0000] [30377] [INFO] Starting gunicorn 19.9.0
  [2018-12-21 18:13:55 +0000] [30377] [INFO] Listening at: http://0.0.0.0:80 (30377)
  [2018-12-21 18:13:55 +0000] [30377] [INFO] Using worker: sync
  [2018-12-21 18:13:55 +0000] [30381] [INFO] Booting worker with pid: 30381
  [2018-12-21 18:14:00,240] ERROR in app: Exception on / [GET]
  Traceback (most recent call last):
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
      response = self.full_dispatch_request()
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
      rv = self.dispatch_request()
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "/home/websites/test2/server.py", line 10, in home
      return render_template('home.html')
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/templating.py", line 134, in render_template
      return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/jinja2/environment.py", line 869, in get_or_select_template
      return self.get_template(template_name_or_list, parent, globals)
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/jinja2/environment.py", line 830, in get_template
      return self._load_template(name, self.make_globals(globals))
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/jinja2/environment.py", line 804, in _load_template
      template = self.loader.load(self, name, globals)
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/jinja2/loaders.py", line 113, in load
      source, filename, uptodate = self.get_source(environment, name)
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/templating.py", line 58, in get_source
      return self._get_source_fast(environment, template)
    File "/home/websites/test2/test2/local/lib/python2.7/site-packages/flask/templating.py", line 86, in _get_source_fast
      raise TemplateNotFound(template)
  TemplateNotFound: home.html
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>from flask import Flask, render_template
  
  
  app = Flask('__main__', template_folder='../../')
  
  
  @app.route('/')
  def home():
  #    return "&lt;h1&gt;test2 - server.py - raw return&lt;/h1&gt;"
      return render_template('home.html')
  #    return app.root_path
  
  
  if __name__ == '__main__':
      app.run(host='0.0.0.0', debug=True)
  </code></pre>
  
  <p>Any help appreciated.</p>