Jinja can't find template path Jinja can't find template path python-3.x python-3.x

Jinja can't find template path


You are using the FileSystemLoader class which has the following init arguments:

class FileSystemLoader(BaseLoader):    def __init__(self, searchpath, encoding='utf-8', followlinks=False):

You are initializing it with 2 arguments: frontdesk and templates, which basically does not make much sense, since the templates string would be passed as an encoding argument value. If you want to continue using FileSystemLoader as a template loader, use it this way:

from jinja2 import Environment, FileSystemLoaderenv = Environment(loader=FileSystemLoader('frontdesk/templates'))template = env.get_template('index.html')

Or, if you meant to use the PackageLoader class:

from jinja2 import Environment, PackageLoaderenv = Environment(loader=PackageLoader('frontdesk', 'templates'))template = env.get_template('index.html')

In this case you need to make sure frontdesk is a package - in other words, make sure you have __init__.py file inside the frontdesk directory.