[Django] #22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS

10 views
Skip to first unread message

Django

unread,
Jun 29, 2014, 6:23:15 AM6/29/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
------------------------------------+--------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------
It could be useful for beginners like me to know that without adding:

"django.core.context_processors.media",

to your TEMPLATE_CONTEXT_PROCESSORS, you will not get MEDIA_URL in your
template. I found it easily on stack overflow though.

But it was not here:

https://docs.djangoproject.com/fr/1.6/howto/static-files/

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

Django

unread,
Jul 2, 2014, 9:21:44 AM7/2/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
------------------------------------+--------------------------------------

Reporter: raphael.herouart@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

I'm not sure that's the best page for mentioning this as there's no
example of referring to uploaded files in templates.

There's a warning in the
[https://docs.djangoproject.com/en/1.6/ref/settings/ settings docs]: "Be
careful when you override settings, especially when the default value is a
non-empty tuple or dictionary, such as MIDDLEWARE_CLASSES and
TEMPLATE_CONTEXT_PROCESSORS. Make sure you keep the components required by
the features of Django you wish to use."

I think if you had seen that, you'd probably have looked at the initial
`TEMPLATE_CONTEXT_PROCESSORS` list and checked what each of them did. What
do you think?

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

Django

unread,
Jul 2, 2014, 2:09:38 PM7/2/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
------------------------------------+--------------------------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------

Comment (by guardian):

I'm not sure, I think it is obvious to you that the problem is due to
TEMPLATE_CONTEXT_PROCESSORS. But to a beginner, is obvious only what shows
up using Google. And the two first pages that I found using "MEDIA_URL
django" were the one you mentioned and the one I mentioned.

Also, even if the beginner is smarter than me and search for the template
context processors,he'll google both "context_processors.media" or
"django.core.context_processors.media", and find no explanation.

I thought static files was a better place to add some section about
templates because it is more "focused", settings page looks like a big
dictionary. But really it is up to you.

--
Ticket URL: <https://code.djangoproject.com/ticket/22924#comment:2>

Django

unread,
Jul 2, 2014, 3:45:09 PM7/2/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
------------------------------------+--------------------------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------

Comment (by guardian):

oh... I just got what you meant. Actually, I don't remember having
modified these settings. Maybe inadvertently. Sorry, English is not my
mother tongue.

--
Ticket URL: <https://code.djangoproject.com/ticket/22924#comment:3>

Django

unread,
Jul 2, 2014, 8:17:54 PM7/2/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
--------------------------------------+------------------------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

How about the attached patch?

--
Ticket URL: <https://code.djangoproject.com/ticket/22924#comment:4>

Django

unread,
Jul 3, 2014, 8:36:44 AM7/3/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
--------------------------------------+------------------------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by guardian):

Fine. It is perfect. Thanks a lot.

--
Ticket URL: <https://code.djangoproject.com/ticket/22924#comment:5>

Django

unread,
Jul 3, 2014, 9:39:05 AM7/3/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
--------------------------------------+------------------------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"814bcc33951db8a469b9bba26fb021fc2d8ad480"]:
{{{
#!CommitTicketReference repository=""
revision="814bcc33951db8a469b9bba26fb021fc2d8ad480"
Fixed #22924 -- Added a note about MEDIA_URL in templates.

Thanks raphael.herouart at gmail.com
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22924#comment:6>

Django

unread,
Jul 3, 2014, 9:39:27 AM7/3/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
--------------------------------------+------------------------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"890a2d632e173edfd2b70854b72dfbd0e1a2d92b"]:
{{{
#!CommitTicketReference repository=""
revision="890a2d632e173edfd2b70854b72dfbd0e1a2d92b"
[1.6.x] Fixed #22924 -- Added a note about MEDIA_URL in templates.

Thanks raphael.herouart at gmail.com

Backport of 814bcc3395 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22924#comment:7>

Django

unread,
Jul 3, 2014, 9:39:28 AM7/3/14
to django-...@googlegroups.com
#22924: MEDIA_URL needs TEMPLATE_CONTEXT_PROCESSORS
--------------------------------------+------------------------------------
Reporter: raphael.herouart@… | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"f99267e5e6779d192959569155846f8b0ca5eb07"]:
{{{
#!CommitTicketReference repository=""
revision="f99267e5e6779d192959569155846f8b0ca5eb07"
[1.7.x] Fixed #22924 -- Added a note about MEDIA_URL in templates.

Thanks raphael.herouart at gmail.com

Backport of 814bcc3395 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22924#comment:8>

Reply all
Reply to author
Forward
0 new messages