Sorunun sebebi gerçeğinden sonra açıktır, ama ben burada çok açık nedenini paylaşmak istiyorum.jinja2.exceptions.TemplateNotFound neden sadece jinja2 kullanırken bile
bu sorunu alırsanız kodu gibi
import jinja2
templateLoader = jinja2.FileSystemLoader(searchpath=".")
templateEnv = jinja2.Environment(loader=templateLoader,
trim_blocks=True,
lstrip_blocks=True)
htmlTemplateFile = 'file.jinja.html'
htmlTemplate = templateEnv.get_template(htmlTemplateFile)
çalıştıran:
Traceback (most recent call last):
...
File "file.py", line xyz, in some_func
htmlTemplate = templateEnv.get_template(htmlTemplateFile)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jinja2/environment.py", line 812, in get_template
return self._load_template(name, self.make_globals(globals))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jinja2/environment.py", line 774, in _load_template
cache_key = self.loader.get_source(self, name)[1]
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jinja2/loaders.py", line 187, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: file.jinja.html
bu sorun jinja2 etkileşimi ile bir ilgisi olması gerektiğini tartışmaları çevrimiçi noktası bulabilir flask, veya SQL ile birlikte GAE ile veya şablonlarınız bir "şablon" klasöründe olmayabilir, ancak bu sorunetkileşiminden kaynaklanabilirve os
modülü.