Difference between revisions of "Passing an integer via URL in Flask App"
(Created page with "One of the key skills for web apps will be to pass a variable using the URL. =Edit the 'app.route'= You need to add the parameter in '<' & '>' brackets. The 'int' is the data...") |
(No difference)
|
Latest revision as of 13:46, 13 February 2020
One of the key skills for web apps will be to pass a variable using the URL.
Edit the 'app.route'
You need to add the parameter in '<' & '>' brackets. The 'int' is the data type:
@app.route("/product/<int:param>/")
Edit the def
You will need to add the name of the parameter from the 'app.route' string:
def go_to(param):
Using the parameter
This variable is now available in the entire 'def' for this route.