Code

Opened 8 years ago

Closed 7 years ago

Last modified 6 years ago

#2891 closed enhancement (wontfix)

ADMIN_MEDIA_PREFIX set to /admin_media/ in settings template

Reported by: radek Owned by: nobody
Component: Core (Other) Version: master
Severity: normal Keywords:
Cc: cgrady@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I propose to change default settings for ADMIN_MEDIA_PREFIX in http://code.djangoproject.com/browser/django/trunk/django/conf/project_template/settings.py

instead of: ADMIN_MEDIA_PREFIX = '/media/'
to use: ADMIN_MEDIA_PREFIX = '/adminmedia/'

so it will not confuse when setting MEDIA_URL to /media/ (as is suggested in several documents)

Attachments (5)

patch (603 bytes) - added by radek 7 years ago.
patch
admin_media.patch (1.2 KB) - added by SmileyChris 7 years ago.
with docs
2891.patch (994 bytes) - added by Collin Grady <cgrady@…> 7 years ago.
patch updated against [5722]
2891.2.patch (3.6 KB) - added by SmileyChris 7 years ago.
2891-backwards-incompatible.patch (3.4 KB) - added by SmileyChris 7 years ago.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 8 years ago by SmileyChris

Or /admin_media/, but I like the proposal.

comment:2 Changed 7 years ago by Gary Wilson <gary.wilson@…>

  • Has patch set
  • Needs documentation set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Design decision needed

#3417 also talks about changing ADMIN_MEDIA_PREFIX.

This would need a real patch and some documentation.

Changed 7 years ago by radek

patch

comment:3 Changed 7 years ago by radek

  • Summary changed from ADMIN_MEDIA_PREFIX set to /adminmedia/ in settings template to [patch] ADMIN_MEDIA_PREFIX set to /adminmedia/ in settings template

added patch

Changed 7 years ago by SmileyChris

with docs

comment:4 Changed 7 years ago by SmileyChris

  • Needs documentation unset
  • Patch needs improvement unset

Changed 7 years ago by Collin Grady <cgrady@…>

patch updated against [5722]

comment:5 Changed 7 years ago by Collin Grady <cgrady@…>

  • Cc cgrady@… added

I also believe this should be changed, it catches a ridiculous amount of people trying to run through things in the django IRC channel, since /media/ is so common a choice for site media

comment:6 Changed 7 years ago by SmileyChris

  • Summary changed from [patch] ADMIN_MEDIA_PREFIX set to /adminmedia/ in settings template to [patch] ADMIN_MEDIA_PREFIX set to /admin_media/ in settings template
  • Triage Stage changed from Design decision needed to Ready for checkin

It's a non-critical change which makes things clearer. I'm going to just promote to ready for checkin.

comment:7 Changed 7 years ago by gwilson

  • Patch needs improvement set
  • Summary changed from [patch] ADMIN_MEDIA_PREFIX set to /admin_media/ in settings template to ADMIN_MEDIA_PREFIX set to /admin_media/ in settings template
  • Triage Stage changed from Ready for checkin to Accepted

There are a few other places we would probably want to make the change also, namely:

  • django/docs/fastcgi.txt
  • django/contrib/admin/templatetags/admin_modify (include_admin_script docstring)
  • django/conf/global_settings.py

Changed 7 years ago by SmileyChris

comment:8 Changed 7 years ago by SmileyChris

  • Patch needs improvement unset
  • Triage Stage changed from Accepted to Ready for checkin

Ok, I've changed it in all the appropriate places now. For complete backwards compatibility, global_settings.py needs to remain as '/media/'.

The documentation now clarifies that the fall-back default is still '/media/' but the new default in a settings.py file created with django-admin.py startproject is '/admin_media/'.

Changed 7 years ago by SmileyChris

comment:9 Changed 7 years ago by SmileyChris

  • Triage Stage changed from Ready for checkin to Design decision needed

Talking with Collin, he thinks that we should just change the default to '/admin_media/' and mention it in the BackwardsIncompatibleChanges.

Either patch is ready for checkin, but needs a decision on which way to go.

comment:10 Changed 7 years ago by mtredinnick

I would tend to side with Collin on this one, because ADMIN_MEDIA_PREFIX appears in settings.py by default, so few systems using that will fall back to the default in global_settings. Hence the impact will be minor and having global_settings and settings being the same is a win. Still want to think about it a bit more to think of hidden traps, but I suspect the second way and wearing the slight backwards-compat breakage is the more logical approach.

comment:11 Changed 7 years ago by SmileyChris

  • Triage Stage changed from Design decision needed to Ready for checkin

Ok, I still see the only "trap" is anyone who has removed the ADMIN_MEDIA_PREFIX from their settings and is just relying on the global setting will have breakage, but this is an edge case.

Let's just do it.

comment:12 Changed 7 years ago by jacob

  • Triage Stage changed from Ready for checkin to Design decision needed

Given that there's disagreement between a couple of core devs (me and Malcolm), this isn't actually ready for checkin at all.

comment:13 Changed 7 years ago by jacob

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

OK, Malcolm and I have discussed this IRL and decided that this ticket will just break too many people's code. We should instead change the documentation to not suggest that people set MEDIA_URL to "/media/" also.

comment:14 Changed 7 years ago by SmileyChris

Bit disappointed with the wontfix, /media/ is the most obvious choice for MEDIA_URL.

I wrote a backwards compatible patch too y'know...

comment:15 Changed 7 years ago by Collin Grady <cgrady@…>

I don't see how it would break many people's code at all - do you really think there are that many people who completely remove ADMIN_MEDIA_PREFIX from settings.py?

comment:16 Changed 7 years ago by Uninen

This is just plain silly. We're nearing 1.0 (or whatever it will be called) release which will have backwards incompatible changes, and everyone agrees that we want to have best possible APIs and defaults by then. Suggesting that MEDIA_URL should not be "/media/" and that ADMIN_MEDIA_PREFIX *should* be "/media/" is just, well, wrong.

The thing I love about Django is that it encourages to do things the right way. To me it feels like changing documentation here is the easy way out instead of fixing the real problem, whatever it is.

No offence to anyone, just wanted to share my thoughts.

comment:17 Changed 6 years ago by sander@…

I agree with Uninen. I now have to change this manually for every site/project I create. The current name is confusing and conflicts with the most obvious situation: having MEDIA_URL = '/media/'. Existing sites already have ADMIN_MEDIA_PREFIX = '/media/' and won't be broken by applying this patch, and even if they removed ADMIN_MEDIA_PREFIX the backwards-compatibility patch can solve that.

Please reconsider this patch. The way it is currently done is _not_ the best way. Please fix this while still possible before the 1.0 release.

comment:18 Changed 6 years ago by anonymous

Sander, I encourage you to bring this up on the django-dev Google group if you wish to discuss it rather than just posting in a wontfixed ticket.

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.