url_for
Generate a URL to the given endpoint with the given values. This requires an active request or application context, and calls :meth:current_app.url_for() < flask.Flask.url_for >. See that method for full documentation.
def url_for(
endpoint: str,
_anchor: str | None = None,
_method: str | None = None,
_scheme: str | None = None,
_external: bool | None = None,
**values: Any
) - > string
Generate a URL to the given endpoint with the given values. This requires an active request or application context, and calls :meth:current_app.url_for() < flask.Flask.url_for >. See that method for full documentation.
Parameters
| Name | Type | Description |
|---|---|---|
| endpoint | str | The endpoint name associated with the URL to generate. If this starts with a ".", the current blueprint name (if any) will be used. |
| _anchor | `str | None` = None |
| _method | `str | None` = None |
| _scheme | `str | None` = None |
| _external | `bool | None` = None |
| **values | Any | Values to use for the variable parts of the URL rule. Unknown keys are appended as query string arguments, like "?a=b&c=d". |
Returns
| Type | Description |
|---|---|
string | The generated URL string, including the scheme and domain if external, and any query parameters or anchors. |