Closed gnbl closed 4 years ago
Cause: there is a non-template (.tpl), non-python (.py) file with the same name test.html
in the base directory where t.py
resides.
Feel free to close if this is working as designed - however, I think whatever is searching/finding this file then seems to disregard it as a template, causing zero output nor error.
The Bottle default template path is ['./', './views/']
and templates are allowed to end in .html
, so this is unfortunate, but by design. The template logic just finds the html file first and stops looking.
Oh, I just noticed that the html file in question was empty, so that explains the lack of output. Sorry about this...
In case anyone else wants to modify the defaults, they are here:
TEMPLATE_PATH = ['./', './views/']
in https://github.com/bottlepy/bottle/blob/master/bottle.py#L4291extensions = ['tpl', 'html', 'thtml', 'stpl']
in https://github.com/bottlepy/bottle/blob/master/bottle.py#L3798
On Windows 10 with
no output (nor error / Exception) is generated when running
t.py
:and
views/test.tpl
:The same file with a different name, e.g.
test1
, works as expected.So this string somehow trips
template()
https://github.com/bottlepy/bottle/blob/master/bottle.py#L4221