Opened 16 years ago

Closed 16 years ago

#9930 closed (invalid)

An error in part three of Django's tutorial.

Reported by: crazy2k Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords: tutorial regular expression strip urls
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The part three of Django's tutorial (http://docs.djangoproject.com/en/dev/intro/tutorial03/#intro-tutorial03) says:
"Then, Django will strip off the matching text ("polls/") and send the remaining text -- "34/" -- to the 'mysite.polls.urls' URLconf for further processing."

Shouldn't it say something like "Django will strip off the first substring, from left to right, that matches"? Because I think the whole "/polls/34/" would match, and just the first part is removed..

Change History (2)

comment:1 by crazy2k, 16 years ago

Also, it says
"The idea behind include() and URLconf decoupling is to make it easy to plug-and-play URLs. Now that polls are in their own URLconf, they can be placed under "/polls/", or under "/fun_polls/", or under "/content/polls/", or any other URL root, and the app will still work."

That's not entirely true, is it? The first argument to patterns() in "/[polls|fun_polls|etc]/urls.py" and the path given to "include()" in the project's main urls.py would also have to be changed if the URLconf file for the app is moved.

comment:2 by Luke Plant, 16 years ago

Resolution: invalid
Status: newclosed

First point: the tutorial is correct in the way it describes how include() works, I can't think of any clearer way to explain it, so I'll just presume you have misunderstood.

Second: It seems when you talk about 'moving' apps you are referring to changing the 'Python path' of the app (where you import it from). If you change the module hierarchy of an app, it is inevitable that you will have to change anything that refers to it (whether using import statements or dotted paths). But the tutorial is referring to changing where it is 'hosted' in the URL hierarchy, so the statement made about URLconf decoupling is "entirely true".

Thanks.

Note: See TracTickets for help on using tickets.
Back to Top