Python Forum
Flask do not accept sub-folder in Template ?! : Solved
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask do not accept sub-folder in Template ?! : Solved
#1
Thumbs Up 
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.
Reply
#2
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.
Reply
#3
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!).
SpongeB0B likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Solved] Running Gunicorn with flask.... SpongeB0B 1 1,588 Jun-27-2022, 03:09 PM
Last Post: SpongeB0B
  show csv file in flask template.html rr28rizal 8 34,526 Apr-12-2021, 09:24 AM
Last Post: adamabusamra
Question Flask, send_from_directory not working : solved SpongeB0B 2 7,346 Jan-26-2021, 07:02 AM
Last Post: SpongeB0B
  cant access root environment folder from django folder using __init__.py Sanjish 0 1,874 Dec-25-2020, 05:56 AM
Last Post: Sanjish
  how to pass javascript variables to url_for function in a flask template experimental 5 6,290 Oct-29-2020, 03:29 AM
Last Post: universe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020