Opened 18 years ago

Closed 17 years ago

Last modified 17 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: dev
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: no UI/UX: no

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

Download all attachments as: .zip

Change History (23)

comment:1 by Chris Beaven, 18 years ago

Or /admin_media/, but I like the proposal.

comment:2 by Gary Wilson <gary.wilson@…>, 18 years ago

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.

by radek, 18 years ago

Attachment: patch added

patch

comment:3 by radek, 18 years ago

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

added patch

by Chris Beaven, 18 years ago

Attachment: admin_media.patch added

with docs

comment:4 by Chris Beaven, 18 years ago

Needs documentation: unset
Patch needs improvement: unset

by Collin Grady <cgrady@…>, 17 years ago

Attachment: 2891.patch added

patch updated against [5722]

comment:5 by Collin Grady <cgrady@…>, 17 years ago

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

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 by Gary Wilson, 17 years ago

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

by Chris Beaven, 17 years ago

Attachment: 2891.2.patch added

comment:8 by Chris Beaven, 17 years ago

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/'.

by Chris Beaven, 17 years ago

comment:9 by Chris Beaven, 17 years ago

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 by Malcolm Tredinnick, 17 years ago

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

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

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

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

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 by Collin Grady <cgrady@…>, 17 years ago

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

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 by sander@…, 17 years ago

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

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