diff options
| author | Tim Graham <timograham@gmail.com> | 2016-03-09 12:18:21 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-03-09 12:19:41 -0500 |
| commit | 301edde86d07fe27a4aa002b1546d2a3002190dc (patch) | |
| tree | 60046100a452c2af507586c474a0d827f6caa4f1 /docs/intro/tutorial01.txt | |
| parent | 43bb6727d09347f8c4c1a6541e2086a1a69811e1 (diff) | |
[1.9.x] Fixed #26255 -- Fixed orphaned include() reference following tutorial reordering.
Backport of 4323676ea5ab6994feb1385522665069d84f397b from master
Diffstat (limited to 'docs/intro/tutorial01.txt')
| -rw-r--r-- | docs/intro/tutorial01.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index 0bdc593ec9..de86571df3 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -298,6 +298,20 @@ an :func:`~django.conf.urls.include` in the ``urlpatterns`` list, so you have: url(r'^admin/', admin.site.urls), ] +The :func:`~django.conf.urls.include` function allows referencing other +URLconfs. Note that the regular expressions for the +:func:`~django.conf.urls.include` function doesn't have a ``$`` (end-of-string +match character) but rather a trailing slash. Whenever Django encounters +:func:`~django.conf.urls.include`, it chops off whatever part of the URL +matched up to that point and sends the remaining string to the included URLconf +for further processing. + +The idea behind :func:`~django.conf.urls.include` is to make it easy to +plug-and-play URLs. Since polls are in their own URLconf +(``polls/urls.py``), they can be placed under "/polls/", or under +"/fun_polls/", or under "/content/polls/", or any other path root, and the +app will still work. + .. admonition:: When to use :func:`~django.conf.urls.include()` You should always use ``include()`` when you include other URL patterns. |
