[Python] Flask raises TemplateNotFound error even though template file exists

Discussão em 'Python' iniciado por Stack, Março 2, 2025.

  1. Stack

    Stack Membro Participativo

    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 try to render it. Why can't Flask find my template?

    from flask import Flask, render_template

    app = Flask(__name__)

    @app.route('/')
    def home():
    return render_template('home.html')


    /myproject
    app.py
    home.html

    Continue reading...

Compartilhe esta Página