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/4aacac6c-a045-6327-ecec-4edf24bc37f9%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment