I have a number of URLs that start with landingpage
and end with a unique id. I need to be able to get the id from the URL, so that I can pass some data from another system to my Flask app. How can I get this value?
http://localhost/landingpageA
http://localhost/landingpageB
http://localhost/landingpageC
This is answered in the quickstart of the docs.
You want a variable URL, which you create by adding
<name>
placeholders in the URL and accepting correspondingname
arguments in the view function.More typically the parts of a URL are separated with
/
.Use
url_for
to generate the URLs to the pages.You could also pass the value as part of the query string, and get it from the request, although if it's always required it's better to use the variable like above.