I started learning Flask framework recently and made a short program to understand request/response
cycle in flask.
My problem is that last method called calc
doesn't work.
I send request as:
and I get error:
"Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again."
Below is my flask app code:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "<h1>Hello, World!</h1>"
@app.route('/user/<name>')
def user(name):
return '<h1>Hello, {0}!</h1>'.format(name)
@app.route('/math/calculate/<string:var1>/<int:var2>')
def calc(var1, var2):
return '<h1>Result: {0}!</h1>'.format(int(var1)+int(var2))
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80, debug=True)