Flask CRUD
About Lesson

In this Flask CRUD Application lesson we are going to learn about Flask CRUD Application Retrieving Data from MySQL, so we have learned that how you can insert data to your MySQL database, now it is time to retrieve the data from the MySQL database and show them in our table.

 

 

Open your App.py file and bring changes to your Index route, basically in here first we are going to get our all data from the mysql database and after that we send the data via context variable to our index.html file.

 

 

 

This is the complete code for App.py file.

 

 

 

Now open your index.html file, in here using  for loop we want to iterate over the data and after that we show our data in the table.

 

 

 

This is the complete code for index.html file.

 

 

 

Run your application and you can see our data from mysql database in the table.

Flask CRUD Application Retrieving Data from MySQL
Flask CRUD Application Retrieving Data from MySQL

 

 

templates/base.html

 

 

 

templates/header.html

 

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