Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python jinja模板扩展了相对/绝对路径_Python_Jinja2 - Fatal编程技术网

Python jinja模板扩展了相对/绝对路径

Python jinja模板扩展了相对/绝对路径,python,jinja2,Python,Jinja2,我的文件夹结构看起来像 └── templates ├── base.html ├── foo │   ├── 1.html │   ├── 2.html └── bar ├── 1.html └── 2.html 如何用base.html扩展1.html、2.html? “./”在模板内不起作用 {%extends../base.html%%} env = Environment(loader=FileSystemLoa

我的文件夹结构看起来像

└── templates
    ├── base.html
    ├── foo
    │   ├── 1.html
    │   ├── 2.html
    └── bar
        ├── 1.html
        └── 2.html
如何用base.html扩展1.html、2.html? “./”在模板内不起作用

{%extends../base.html%%}

env = Environment(loader=FileSystemLoader('templates/%s/' % (channel == 0 and 'foo' or 'bar')))
templ = templateId + '.html'
templ = env.get_template(templ)
output = templ.render(data=data)
我得到{TemplateNotFound}../base.html