Pass a list from python to flask so that it will not show in the html

Viewed 18

I saw many answers on how to pass a list from python to flask. All of them suggest to pass it as a variable on the render_template. For example

render_template('map.html', trends=trends)

And then on the flask template get it using

{{ trends | safe }}

The problem with this solution is that once someone opens the source of the html, the list is shown.

I DO NOT want the list to show.

In my case the list consists of hundreds of elements and it is ugly and not elegant.

The list will be used in the the java script part of the html.

Any help will be appreciated.

1 Answers

The way I solved it is by using an ajax to get the data from the app

Related