Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#11991 closed (wontfix)

Inconsistent MEDIA_URL values

Reported by: anonymous Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The documentation states the following:

URL that handles the media served from MEDIA_ROOT. Example: ""

Note that this should have a trailing slash if it has a path component.

Good: "" Bad: ""

Why does a path component need to have a trailing slash but a domain doesn't?

We should pick one of these forms, as changing the value affects other areas (like the FileField.url attribute).
I, personally, think the slash-less form makes templates look better:

<a href="{{ MEDIA_URL }}/bla.js">...</a>

<a href="{{ MEDIA_URL }}bla.js">...</a>

Change History (5)

comment:1 Changed 8 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

This isn't something we can change easily. The conventions for MEDIA_URL and MEDIA_ROOT are well established now. Unless you have a proposal for how we can make this change completely transparent, I'm marking wontfix.

comment:2 Changed 8 years ago by Jannis Leidel

I believe this is related to #12323 which proposes to introduce a separate setting pair STATIC_ROOT/STATIC_URL to differentiate between media files used by forms and widgets (e.g. provided by 3rd party apps) and user generated media files (e.g. file uploads).

comment:3 Changed 7 years ago by anonymous

milestone: 1.21.3

russellm, what difference would it make? Are these values being used by components other that the templates and the file upload field?

comment:4 Changed 7 years ago by Jannis Leidel

I could see a way to make this work by having the settings module check those values and append a slash if needed (yeah, I want those settings to having a trailing slash). Alternatively this could be fixed in the context processor or get_staticfiles_prefix template tag now.

comment:5 Changed 7 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top