flask conditional according to urrl

Solutions on MaxInterview for flask conditional according to urrl by the best coders in the world

showing results for - "flask conditional according to urrl"
Facundo
09 Jul 2018
1<!DOCTYPE html>
2<html>
3<head>
4    <title>Template</title>
5</head>
6<body>
7    <h3>You are here: {{ request.path }}</h3>
8    {% if request.path == url_for('show_funding') %}
9        <script src="{{ url_for ('static', filename='js/funding.js')}}"></script>
10    {% endif %}
11</body>
12</html>
13
Jacopo
18 Jan 2017
1from flask import Flask
2from flask import request
3from flask import render_template
4
5app = Flask(__name__)
6
7@app.route('/')
8def show_index():
9    return render_template('funding.html')
10
11@app.route('/funding')
12def show_funding():
13    return render_template('funding.html')
14
15if __name__ == '__main__':
16    app.run(debug = True) 
17