Flask -- route there are three methods for routing flask (example:
- Flask. flask. route decorator (for more information about decorator, see this article). In this case, add the desired route to the parameters of the decorator. The parameter can be expressed as <>
- Flask. Flask. add_url_rule Function
- Use the flask underlying werkzeug to provideFlask. Flask. url_map Function
Processing of the last "/" in the route
Flask regards "/" as a path similar to the path in the Linux file system. Therefore, when there is no final "/" in the route, this path is equivalent to a file in the file system, in this case, if the input path contains "/", the server will produce a 404 error. If there is a final "/", this path is equivalent to the directory of the file system, therefore, if the input path does not contain "/", flask automatically jumps to the path with "/", that is, a directory is opened.
Routing Parameters
Parameters are as follows:<Converter: Name> indicates the parameter type, and converter indicates the parameter type. There are four available types:
String |
Accepts any text without a slash (the default) |
Int |
Accepts Integers |
Float |
LikeIntBut for floating point values |
Path |
Like the default but also accepts slashes |