Categories
Python Answers

How to fix Python Flask raising TemplateNotFound error even though template file exists?

Spread the love

Sometimes, we want to fix Python Flask raising TemplateNotFound error even though template file exists.

In this article, we’ll look at how to fix Python Flask raising TemplateNotFound error even though template file exists.

How to fix Python Flask raising TemplateNotFound error even though template file exists?

To fix Python Flask raising TemplateNotFound error even though template file exists, we can set the template_folder to the folder with the templates in our project.

For instance, we write

app = Flask(__name__, template_folder='template') 

to set the template_folder argument to the path string relative to our project folder.

Conclusion

To fix Python Flask raising TemplateNotFound error even though template file exists, we can set the template_folder to the folder with the templates in our project.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *