Reputation: 73
I've a function that prepare an url:
def my_url():
params = {"client_id": CLIENT_ID,
"response_type": "code",
"state": "abcdefg",
"redirect_uri": REDIRECT_URI}
url = "https://ssl.myapi.com/?" + urllib.parse.urlencode(params)
return url
How can I insert the generated link, in my templates? Eg:
< a href=my_url> login < /a>
Upvotes: 1
Views: 913
Reputation: 348
The render_template function accepts arbitrary variables.
Simply:
render_template(‘index.html’, myurl=myurl)
And you can now access myurl from your template.
<a href=“{{myurl}}”> login </a>
Upvotes: 5