Flask raises TemplateNotFound error even though template file exists

前端 未结 11 1382
别跟我提以往
别跟我提以往 2020-11-21 23:02

I am trying to render the file home.html. The file exists in my project, but I keep getting jinja2.exceptions.TemplateNotFound: home.html when I t

11条回答
  •  礼貌的吻别
    2020-11-21 23:29

    You need to put all you .html files in the template folder next to your python module. And if there are any images that you are using in your html files then you need put all your files in the folder named static

    In the following Structure

    project/
        hello.py
        static/
            image.jpg
            style.css
        templates/
            homepage.html
        virtual/
            filename.json
    

提交回复
热议问题