0

I am building a python web app with Flask.

I got 3 lists (same length) with about 3,000 data each from my python code.

And like to make them into a table in the html file, how should I write the html template (the tr, td things).

I could only find tutorial about passing one single variable to html.

If there are any references for me to study I will appreciate that a lot.

Tsao
  • 139
  • 1
  • 10

2 Answers2

1

You can use javascript to achieve this.

Create a rest api with some url like http://yoursite/data which gives this large data in json format.

Then use a ajax calls to fetch data and use javascript/angular/jquery script to fill the data into html table.

Some refs:

https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

Using jQuery to build table rows from Ajax response (Json)

Populate html table on jquery success event

Jomin
  • 113
  • 2
  • 8
0

Since Flask uses Jinja2, you can take Jinja2 Documentation as reference.

InQβ
  • 518
  • 4
  • 22