Skip to main content

include

Parses and validates URL configuration modules or pattern lists, returning a tuple containing the module, application name, and namespace. It dynamically imports string-based module paths and ensures that the provided configuration adheres to Django's namespacing and internationalization requirements.

def include(
arg: str|tuple|list,
namespace: str = None
) - > tuple

Includes a full URLconf module or a list of URL patterns into the current routing configuration. This allows for modularizing URL definitions and applying namespaces to groups of routes.

Parameters

NameTypeDescription
arg`strtuple
namespacestr = NoneThe instance namespace for the included URL patterns, used to differentiate between multiple instances of the same application.

Returns

TypeDescription
tupleA 3-tuple containing the URLconf module or pattern list, the application name, and the instance namespace.