Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#18397 closed Cleanup/optimization (fixed)

Change examples

Reported by: jonatan@… Owned by: aaugustin
Component: Core (Other) Version: 1.4
Severity: Normal Keywords:
Cc: dbrgn Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description mentions as an example URL at four places:

# Example: "/home/media/"
# Examples: "", ""
# Example: "/home/media/"
# Example: ""

Given the already somewhat confusing history and current state of the media/static settings, I recommend we use another site as an example, since from what I understand, the media subdomain is merely a coincidence. Perhaps instead? :)

Will supply a patch if this is a good idea.

Change History (9)

comment:1 Changed 4 years ago by russellm

  • Component changed from Documentation to Core (Other)
  • Easy pickings set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Agreed that we shouldn't be referencing If nothing else, there's the potential that our default setting is causing increased load on the server.

I'd be inclined to use an intentionally dummy server -- -- rather than, for exactly the same reason. On top of that, using could lead to some confusion as to whether a non-django domain can be used. If we stick to a generic placeholder like, it's obvious that the value is meant to be replaced.

The media subdomain isn't a coincidence -- it's a real-life example, with a reasonably common default name. When your site expands, you eventually reach the point where your static media needs to be served from a different box to the rest of your site. When that happens, it's a reasonably common practice to use a subdomain to identify the static media box. 'media' is a common (and obvious) prefix to use.

comment:2 Changed 4 years ago by jonatan@…

What I mean is this:

"Part of the purpose of introducing the staticfiles app is to make it easier to keep static files separate from user-uploaded files." (Managing static files).

So if we want to distinguish the static files from media (user uploaded) files, then certainly we should not mention media as a subdomain for *static* files. For media files, sure, but not for static files.

Take this URL, for example: "/home/media/". 'media' is mentioned three times which makes it really difficult to understand what the setting is referring to. 'If I change this, will I change the subdomain of the site?', etc.

So, while I may agree on not being optimal, what I really think we should change is the media subdomain.

comment:3 Changed 4 years ago by russellm

Ah - got it. Yes, that's definitely something that should be cleaned up.

So - the summary:

  • Change "media" to "static" when we're actually talking about static content.
  • Use rather than
  • Simplify the directory path so it doesn't keep saying "media" -- e.g., /home/ would be clearer than the current example.

comment:4 Changed 3 years ago by jonatan@…

comment:5 Changed 3 years ago by jonatan@…

  • Has patch set

I changed to /var/www/{static,media}, since you'd only use collectstatic in production and if you need it locally you'd override this with a settings_local or similar. But perhaps that's a bit confusing, too?

comment:6 Changed 3 years ago by dbrgn

  • Cc dbrgn added

+1 for the /var/www change.

I added two comments to the pull request, after those things are changed, I'd consider the ticket ready for checkin.

comment:7 Changed 3 years ago by aaugustin

  • Owner changed from nobody to aaugustin

comment:8 Changed 3 years ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from new to closed

In [17f3e9258e6050c274a7294213bd08bb71f2d2da]:

Fixed #18397 -- Avoided referencing

This commit includes multiple small related changes, see the ticket
for a full discussion.

comment:9 Changed 3 years ago by jonatan@…

Fantastic! Very satisfied :)

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