If you followed the "Writing your first Django app" tutorial over here
https://docs.djangoproject.com/en/3.1/intro/tutorial01/, you may end up
with two files {{{mysite/urls.py}}} and {{{polls/urls.py}}} and likely to
make the above amendment to {{{polls/urls.py}}}, which is incorrect. The
files in that case get uploaded to {{{polls/media/images}}} and then
cannot be served (404). The documentation should make it clear the
amendment needs to be done in {{{mysite/urls.py}}}.
For a person writing Django code for the very first time this is not
obvious. I resolved the issue with the help of Django IRC community.
--
Ticket URL: <https://code.djangoproject.com/ticket/32419>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Amansingh1202
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/32419#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/32419#comment:2>
Comment (by Tim Graham):
It seems like a basic understanding of how the URL system works would get
you to the right answer, but... would it be more clear to you if it said,
"you can do this by adding the following snippet to your `ROOT_URLCONF`"
(changing `urls.py` to `ROOT_URLCONF`). I don't think referencing the
filenames in the tutorial here is a good idea.
--
Ticket URL: <https://code.djangoproject.com/ticket/32419#comment:3>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/13978
--
Ticket URL: <https://code.djangoproject.com/ticket/32419#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"51637222b6eeed81d9ce6f5d24e22e249c605ba3" 51637222]:
{{{
#!CommitTicketReference repository=""
revision="51637222b6eeed81d9ce6f5d24e22e249c605ba3"
Fixed #32419 -- Clarified URLconf in example of serving media files.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32419#comment:5>
Comment (by Josef Richter):
Replying to [comment:3 Tim Graham]:
> It seems like a basic understanding of how the URL system works would
get you to the right answer, but... would it be more clear to you if it
said, "you can do this by adding the following snippet to your
`ROOT_URLCONF`" (changing `urls.py` to `ROOT_URLCONF`). I don't think
referencing the filenames in the tutorial here is a good idea.
Yes, probably. I'm just saying it's an easy mistake to make for a beginner
who sees Django for the first time in their life and don't know the
details of its URL system, structuring the app, etc. And it's hard to
identify and fix that mistake for a beginner.
--
Ticket URL: <https://code.djangoproject.com/ticket/32419#comment:6>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"d192d751e15f0573c9ebb16cf5173ab9c3ae3801" d192d751]:
{{{
#!CommitTicketReference repository=""
revision="d192d751e15f0573c9ebb16cf5173ab9c3ae3801"
[3.2.x] Fixed #32419 -- Clarified URLconf in example of serving media
files.
Backport of 51637222b6eeed81d9ce6f5d24e22e249c605ba3 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32419#comment:7>