Skip to main content

url_for

Generate a URL to the given endpoint with the given values.

def url_for(
endpoint: str,
_anchor: str | None = None,
_method: str | None = None,
_scheme: str | None = None,
_external: bool | None = None,
values: t.Any
) - > str

Generate a URL to the given endpoint with the given values. This requires an active request or application context, and calls current_app.url_for(). See that method for full documentation.

Parameters

NameTypeDescription
endpointstrThe endpoint name associated with the URL to generate. If this starts with a ".", the current blueprint name (if any) will be used.
_anchor`strNone` = None
_method`strNone` = None
_scheme`strNone` = None
_external`boolNone` = None
valuest.AnyValues to use for the variable parts of the URL rule. Unknown keys are appended as query string arguments, like ?a=b&c=d.

Returns

TypeDescription
strThe generated URL string.