Saturday, August 26, 2017

Re: Polls tutorial suggested mysite/mysite/urls.py improvement

Mike

Not sure what your github skill level is; but have you considered making a clone of the docs (https://github.com/django/django/blob/master/docs/), changing that page (https://github.com/django/django/blob/master/docs/intro/tutorial01.txt) and then submitting your changes as a new pull request?

I may be speaking out of turn, as I am not a maintainer; but I am sure if you add the above explanation to your submission it will be favorably considered.

Derek

On Saturday, 26 August 2017 09:51:51 UTC+2, Mike Dewhirst wrote:
A potential new Django user (a programmer of many decades experience)
tried Django at my suggestion and struck a problem. Eventually he
tracked me down and challenged me to prove the problem.

I found the problem and feel that the Polls tutorial docs can be easily
improved.

https://docs.djangoproject.com/en/1.11/intro/tutorial01/

In the "Write your first view" section it says ...

The next step is to point the root URLconf at the |polls.urls| module.
In |mysite/urls.py|, add an import for |django.conf.urls.include| and
insert an |include()|
<https://docs.djangoproject.com/en/1.11/ref/urls/#django.conf.urls.include>
in the |urlpatterns| list, so you have:

mysite/urls.py

from  django.conf.urls  import  include,  url from django.contrib 
import  admin

urlpatterns  =  [
      url(r'^polls/',  include('polls.urls')),
      url(r'^admin/',  admin.site.urls),
]


The problem is we have two mysite dirs. The docs are helpful in
suggesting you copy code to paste into urls.py so the focus is on the
code rather than where to put it. On not finding a urls.py in the outer
mysite dir he created one.

The suggestion for improving the docs here is to change the heading line
above from
      mysite/urls.py
to
      mysite/mysite/urls.py

Alternatively, make a pointed reference to the earlier section in the
page where startproject created the *inner* mysite dir containing the
target urls.py. For example, by adding words to the effect that the
inner mysite/urls.py file will be instrumental in the "hello world" step
later in the tutorial.

Cheers

Mike

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ae8d6e4-0760-4441-8a5a-e8bcdd9e0d0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment