Flask Tutorial
About Lesson

In this Flask lesson we are going to learn How to Create Templates in Flask, we can use html templates in our Flask application.

 

 

The first step is that create a new folder at name of templates, make sure that it has the same spelling, if you don’t do this, you will not see the content of your template.

 

After that you need to create html files in your templates folder, iam going to create three html files, the first one is index.html , the second one is contact.html and the third one is about.html.

 

 

templates/index.html

 

 

templates/contact.html

 

 

templates/about.html

 

 

 

After creating of the templates now you can render these templates using render_template() function in the specific views.

 

 

 

Run your flask application and go to http://localhost:5000/, this is the result.

How to Create Templates in Flask
How to Create Templates in Flask

 

 

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found