Opened 10 years ago

Closed 9 years ago

Last modified 9 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 10 years ago.
patch
admin_media.patch (1.2 KB) - added by Chris Beaven 10 years ago.
with docs
2891.patch (994 bytes) - added by Collin Grady <cgrady@…> 9 years ago.
patch updated against [5722]
2891.2.patch (3.6 KB) - added by Chris Beaven 9 years ago.
2891-backwards-incompatible.patch (3.4 KB) - added by Chris Beaven 9 years ago.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 10 years ago by Chris Beaven

Or /admin_media/, but I like the proposal.

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

Has patch: set
Needs documentation: set
Patch needs improvement: set
Triage Stage: UnreviewedDesign decision needed

#3417 also talks about changing ADMIN_MEDIA_PREFIX.

This would need a real patch and some documentation.

Changed 10 years ago by radek

Attachment: patch added

patch

comment:3 Changed 10 years ago by radek

Summary: ADMIN_MEDIA_PREFIX set to /adminmedia/ in settings template[patch] ADMIN_MEDIA_PREFIX set to /adminmedia/ in settings template

added patch

Changed 10 years ago by Chris Beaven

Attachment: admin_media.patch added

with docs

comment:4 Changed 10 years ago by Chris Beaven

Needs documentation: unset
Patch needs improvement: unset

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

Attachment: 2891.patch added

patch updated against [5722]

comment:5 Changed 9 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 9 years ago by Chris Beaven

Summary: [patch] ADMIN_MEDIA_PREFIX set to /adminmedia/ in settings template[patch] ADMIN_MEDIA_PREFIX set to /admin_media/ in settings template
Triage Stage: Design decision neededReady 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 9 years ago by Gary Wilson

Patch needs improvement: set
Summary: [patch] ADMIN_MEDIA_PREFIX set to /admin_media/ in settings templateADMIN_MEDIA_PREFIX set to /admin_media/ in settings template
Triage Stage: Ready for checkinAccepted

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 9 years ago by Chris Beaven

Attachment: 2891.2.patch added

comment:8 Changed 9 years ago by Chris Beaven

Patch needs improvement: unset
Triage Stage: AcceptedReady 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 9 years ago by Chris Beaven

comment:9 Changed 9 years ago by Chris Beaven

Triage Stage: Ready for checkinDesign 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 9 years ago by Malcolm Tredinnick

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 9 years ago by Chris Beaven

Triage Stage: Design decision neededReady 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 9 years ago by Jacob

Triage Stage: Ready for checkinDesign 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 9 years ago by Jacob

Resolution: wontfix
Status: newclosed

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 9 years ago by Chris Beaven

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 9 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 9 years ago by Ville Säävuori

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 9 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 9 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.

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