flask url_for code example
Example 1: default flask app
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Flask'
Example 2: flask api with parameter
args = request.args
print (args) # For debugging
no1 = args['key1']
no2 = args['key2']
return jsonify(dict(data=[no1, no2])) # or whatever is required
Example 3: flask app.route
@app.route("/route/to/page")
def what_to_display_when_someone_goes_here():
return("Whatever.")