conf.urls.include()

include(module, namespace=None, app_name=None) [source] include(pattern_list) include((pattern_list, app_namespace), namespace=None) include((pattern_list, app_namespace, instance_namespace))

A function that takes a full Python import path to another URLconf module that should be “included” in this place. Optionally, the application namespace and instance namespace where the entries will be included into can also be specified.

Usually, the application namespace should be specified by the included module. If an application namespace is set, the namespace argument can be used to set a different instance namespace.

include() also accepts as an argument either an iterable that returns URL patterns, a 2-tuple containing such iterable plus the names of the application namespaces, or a 3-tuple containing the iterable and the names of both the application and instance namespace.

Parameters:
  • module – URLconf module (or module name)
  • namespace (string) – Instance namespace for the URL entries being included
  • app_name (string) – Application namespace for the URL entries being included
  • pattern_list – Iterable of django.conf.urls.url() instances
  • app_namespace (string) – Application namespace for the URL entries being included
  • instance_namespace (string) – Instance namespace for the URL entries being included

See Including other URLconfs and URL namespaces and included URLconfs.

Deprecated since version 1.9: Support for the app_name argument is deprecated and will be removed in Django 2.0. Specify the app_name as explained in URL namespaces and included URLconfs instead.

Support for passing a 3-tuple is also deprecated and will be removed in Django 2.0. Pass a 2-tuple containing the pattern list and application namespace, and use the namespace argument instead.

Lastly, support for an instance namespace without an application namespace has been deprecated and will be removed in Django 2.0. Specify the application namespace or remove the instance namespace.

doc_Django
2016-10-09 18:34:35
Comments
Leave a Comment

Please login to continue.