Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#11991 closed (wontfix)

Inconsistent MEDIA_URL values

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

Description

The documentation states the following:

URL that handles the media served from MEDIA_ROOT. Example: "http://media.lawrence.com"

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

Good: "http://www.example.com/static/" Bad: "http://www.example.com/static"

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>

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

Change History (5)

comment:1 by Russell Keith-Magee, 15 years ago

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 by Jannis Leidel, 15 years ago

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 by anonymous, 14 years ago

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 by Jannis Leidel, 14 years ago

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 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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