Home > database >  Get data from database into Flask template table
Get data from database into Flask template table

Time:02-16

Dears,

I am new to Flask and HTML. I created a python app that is controlled by a SQL Server database (data and settings)

I needed an admin interface, so I used the below template and redesigned the pages. https://github.com/app-generator/flask-argon-dashboard

I just need to query database from this Flask app and put the data into a table in this template. I searched a lot with no hope.

CodePudding user response:

Solved by using pyodbc to query data, and edit /app/home/routes.py like the below:

def myfunction

And then: return render_template("home/" template, segment=segment, data=myfunction())

and on the HTML files, but {% for roww in data %} and {% endfor %} into

  • Related