Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#18397 closed Cleanup/optimization (fixed)

Change media.lawrence.com 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

settings.py mentions media.lawrence.com as an example URL at four places:

# Example: "/home/media/media.lawrence.com/media/"
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
# Example: "/home/media/media.lawrence.com/static/"
# Example: "http://media.lawrence.com/static/"

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 code.djangoproject.com instead? :)

Will supply a patch if this is a good idea.

Attachments (0)

Change History (9)

comment:1 Changed 2 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 lawrence.com. If nothing else, there's the potential that our default setting is causing increased load on the lawrence.com server.

I'd be inclined to use an intentionally dummy server -- example.com -- rather than djangoproject.com, for exactly the same reason. On top of that, using djangoproject.com could lead to some confusion as to whether a non-django domain can be used. If we stick to a generic placeholder like example.com, 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 2 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.lawrence.com/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 lawrence.com not being optimal, what I really think we should change is the media subdomain.

comment:3 Changed 2 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 example.com rather than lawrence.com
  • Simplify the directory path so it doesn't keep saying "media" -- e.g., /home/example.com/media would be clearer than the current example.

comment:4 Changed 2 years ago by jonatan@…

comment:5 Changed 2 years ago by jonatan@…

  • Has patch set

I changed to /var/www/example.com/{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 2 years ago by dbrgn

  • Cc dbrgn added

+1 for the /var/www change.

I added two comments to the pull request https://github.com/django/django/pull/111, after those things are changed, I'd consider the ticket ready for checkin.

comment:7 Changed 2 years ago by aaugustin

  • Owner changed from nobody to aaugustin

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

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

In [17f3e9258e6050c274a7294213bd08bb71f2d2da]:

Fixed #18397 -- Avoided referencing lawrence.com.

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

comment:9 Changed 2 years ago by jonatan@…

Fantastic! Very satisfied :)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.