Skip to main content

redirect

Create a redirect response object. If :data:~flask.current_app is available, it will use its :meth:~flask.Flask.redirect method, otherwise it will use :func:werkzeug.utils.redirect.

def redirect(
location: str,
code: int = 303,
Response: type[BaseResponse] | None
) - > BaseResponse

Create a redirect response object. If :data:~flask.current_app is available, it will use its :meth:~flask.Flask.redirect method, otherwise it will use :func:werkzeug.utils.redirect.

Parameters

NameTypeDescription
locationstrThe URL to redirect to.
codeint = 303The status code for the redirect.
Response`type[BaseResponse]None`

Returns

TypeDescription
BaseResponse