I was playing with my configuration files, and then I saved something, and then suddenly none of my templates can be found in my localhost anymore.
It refuses to find index.html or any templates in my app/templates folder.
My app name was changed, but I changed it back, and it still doesn't fix the error. I changed my basedir variable and secret_key does that have anything to do with it? Because I revert those changes and it still can't find anything. It's like magic, just stopped working all of a sudden. It seems to fail on dispatchingjinjaloader and get_source() function in jinja. StackTrace:
jinja2.exceptions.TemplateNotFound
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
return self.get_template(template_name_or_list, parent, globals)
return self._load_template(name, self.make_globals(globals))
template = self.loader.load(self, name, globals)
source, filename, uptodate = self.get_source(environment, name)
raise TemplateNotFound(template)
Where does Jinja2 figure out where my templates folder is? How come it can't find it anymore?
Where do you set the default folders of templates for jinja???
Ok so apparently, when I changed the name of the app... app_name = 'app', since my templates folder is in app/application/templates, I should have named my app_name = 'application' like it was before (I didn't realize that name was returning application and not app).
Apparently, jinja2 looks at your app_name when initializing Flask()... So odd and I didn't see documentation for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With