[Django] #32666: Clarify mysite/urls.py location for tutorial-01

5 views
Skip to first unread message

Django

unread,
Apr 20, 2021, 4:30:41 AM4/20/21
to django-...@googlegroups.com
#32666: Clarify mysite/urls.py location for tutorial-01
-------------------------------------+-------------------------------------
Reporter: j3soon | Owner: nobody
Type: | Status: new
Uncategorized |
Component: | Version: 3.2
Documentation | Keywords: tutorial
Severity: Normal | clarification
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
According to [this answer on
StackOverflow](https://stackoverflow.com/a/29657129/), 82 people
accidentally created the `mysite/urls.py` in the outer `mysite` directory
(`mysite/mysite/urls.py`) instead of modifying the inner `mysite`
directory (`mysite/urls.py`) when following
[tutorial-01](https://docs.djangoproject.com/en/3.1/intro/tutorial01/).

This PR adds a hint to ask readers to double check the file location. This
can help future readers who encounters this issue to follow the tutorial
more smoothly (instead of searching on Google to see the StackOverflow
post)

Django's [contribution
guideline](https://github.com/django/django/blob/main/CONTRIBUTING.rst)
suggests to create a Trac ticket here beforehand, so I created a fake PR
here: https://github.com/j3soon-pr/django/pull/1

If this clarification is approved, I'll create the formal PR on GitHub.

--
Ticket URL: <https://code.djangoproject.com/ticket/32666>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 20, 2021, 5:08:06 AM4/20/21
to django-...@googlegroups.com
#32666: Clarify mysite/urls.py location for tutorial-01
-------------------------------------+-------------------------------------
Reporter: Johnson | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 3.2
Severity: Normal | Resolution: invalid
Keywords: tutorial | Triage Stage:
clarification | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* type: Uncategorized => Cleanup/optimization
* resolution: => invalid


Comment:

Thanks for the suggestion, however it's explained multiple times in this
tutorial, e.g.

- ''"The outer **mysite/** root directory is a container for your project.
Its name doesn’t matter to Django; you can rename it to anything you
like."''
- ''"**mysite/urls.py**: The URL declarations for this Django project; a
“table of contents” of your Django-powered site. You can read more about
URLs in URL dispatcher."''

The tutorial also instructs reader to modify an existing **
mysite/urls.py** and not to create a new file:

- "In** mysite/urls.py**, add an import for django.urls.include and
insert an include() in the urlpatterns list, so you have: ...."

I don't think any further explanation is needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/32666#comment:1>

Reply all
Reply to author
Forward
0 new messages