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:18:21 -0500 |
| commit | 4323676ea5ab6994feb1385522665069d84f397b (patch) | |
| tree | 43fd1c696adc4db4d2762184ed7ab6607730d0b6 /docs/intro/tutorial01.txt | |
| parent | 602a38d87e4b0d9c5e43678c33208627ca84ce2a (diff) | |
Fixed #26255 -- Fixed orphaned include() reference following tutorial reordering.
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. |
