Redirecting to another page with button click in Python-flask

 

Redirecting to another page with  click in Python-flask




Suppose we have to attach any html page Link in any webpage in python 

<a class="dropdown-item" href="{{ url_for('terms') }}"><span
class="item-text">Terms Conditions</span></a>


<div class="dropdown-items-divide-hr"></div>

<a class="dropdown-item" href="{{ url_for('privacy') }}"><span
class="item-text">Privacy Policy</span></a>



THEN GO TO UR MAIN.PY PAGE :

@app.route('/terms')===> it is the name of file which we have mentioned inside href of above
def terms():====> keep it same as name above
return render_template('terms-conditions.html')====then this page will open when click avove
link:::Terms Conditions - Evolo - StartUp HTML Landing Page Template



@app.route('/privacy') ===> it is the name of file which we have mentioned inside href of above
def privacy()::====> keep it same as name above
return render_template('privacy-policy.html')====then this page will open when click
 avove:


Comments

Popular posts from this blog

Python to automate What's App messages

Building RESTful APIs with Flask in PyCharm