Skip to main content

is_valid_path

Return the ResolverMatch if the given path resolves against the default URL resolver, False otherwise. This is a convenience method to make working with "is this a match?" cases easier, avoiding try...except blocks.

def is_valid_path(
path: str,
urlconf: str | None = None
) - > ResolverMatch | bool

Return the ResolverMatch if the given path resolves against the default URL resolver, False otherwise. This is a convenience method to make working with "is this a match?" cases easier, avoiding try...except blocks.

Parameters

NameTypeDescription
pathstrThe URL path string to be tested against the application's URL configuration.
urlconf`strNone` = None

Returns

TypeDescription
`ResolverMatchbool`