Python Forum
Flask do not accept sub-folder in Template ?! : Solved - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Flask do not accept sub-folder in Template ?! : Solved (/thread-32016.html)



Flask do not accept sub-folder in Template ?! : Solved - SpongeB0B - Jan-15-2021

Hi everyone,

I just realize that apparently we cannot create sub-folder in Templates ! :/

Is that the normal behavior ? if yes , WHY ?


render_template('test\test.html')
Give me an error

render_template('test.html')
work fine.


RE: Flask do not accept sub-folder in Template ?! : Solved - SpongeB0B - Jan-15-2021

I'm too much used to use \ so with

render_template('test/test.html')
it's work !

/ instead of \ too bad the error message was not more explicit.


RE: Flask do not accept sub-folder in Template ?! : Solved - ndc85430 - Jan-15-2021

Remember that \ is used to specify an escape sequence (e.g. \t is the escape sequence for a tab). If you want to include a literal \ in a string, you should use a raw string (or escape it of course!).