I have a base.py file with lots of lists (over 50)
model1 = [
'https://',
'https://',
'https://',
'https://',
'https://',
'https://',
'https://'
]
model2 = [
'https://',
'https://',
'https://',
'https://',
'https://',
'https://',
'https://'
]
Also, another func.py file contains functions for handling url from the base.py file
I need to derive links from the base.py file and the results of functions from the func.py file in the HTML template
Using Flask, I output the links as follows
import base
def index():
return render_template("index.html",
url = base)
Question: How to transfer the desired url of a specific model from a specific list from the base.py file to the func.py file function and display the result of this function in the HTML template using Flask?
HTML template
<tr>
<td>Model</td>
<td><a href="{{ url.model1[0] }}" target="_blank">{{ price0 of func.py }}</a></td>
<td><a href="{{ url.model1[1] }}" target="_blank">{{ price1 of func.py }}</a></td>
<td><a href="{{ url.model1[2] }}" target="_blank">{{ price2 of func.py }}</a></td>
<td><a href="{{ url.model1[3] }}" target="_blank">{{ price3 of func.py }}</a></td>
<td><a href="{{ url.model1[4] }}" target="_blank">{{ price4 of func.py }}</a></td>
<td><a href="{{ url.model1[5] }}" target="_blank">{{ price5 of func.py }}</a></td>
<td><a href="{{ url.model1[6] }}" target="_blank">{{ price6 of func.py }}</a></td>
</tr>
The func.py file contains 6 functions, for each function in the list from the base.py file
func.py
def url1 (murl):
#####################
print(price)
def url2 (murl):
#####################
print(price)