Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#16599 closed Bug (wontfix)

Management commands are collected in the wrong order

Reported by: Klaas van Schelven Owned by: nobody
Component: Core (Management commands) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When multiple management commands of the same name exist, the ones found in apps higher in the INSTALLED_APPS should get precedence; right now, it's reversed.

This is completely analogous to the problem described (and fixed) in
One could basically read that ticket and replace "translations" by "management commands".

In this case, the relevant update statement may be found below:

I'm awfully sorry, don't have the time now to submit a patch. My thoughts would be: either run through the apps in reversed direction, or don't work with an update statement, but rather only add values to the dict if they're not present yet.
The previous, analogous solution is indeed based on 'reversed' and may be found here:

Attachments (1)

image001.jpg (13 bytes) - added by Aymeric Augustin 8 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by anonymous

Component: UncategorizedCore (Management commands)
milestone: 1.4
Resolution: fixed
Status: newclosed
Type: UncategorizedBug

comment:4 Changed 8 years ago by Aymeric Augustin

milestone: 1.4

Revert spam :(

Changed 8 years ago by Aymeric Augustin

Attachment: image001.jpg added

comment:5 Changed 8 years ago by Klaas van Schelven

Resolution: fixed
Status: closedreopened

Bewgh... the spam also marked this as "fixed"

comment:6 Changed 8 years ago by Aymeric Augustin

Triage Stage: UnreviewedDesign decision needed

I'm afraid reversing the order is backwards incompatible. It could cause a wrong command to be executed after an update of Django, with unexpected consequences (read : data loss).

However, it makes sense to have the same order for management commands, templates, translations, and anything else that can be overridden. Otherwise, for instance, it's impossible for an app to override a command and a template of a contrib app.

comment:7 Changed 7 years ago by anonymous

Resolution: wontfix
Status: reopenedclosed

Actually, we've never promised anything about the order of evens in INSTALLED_APPS - the documentation's careful to indicate that the order ought to be considered an implementation detail, not an API. Given that, I'm going to mark this wontfix.

However, there's a very real need here for a consistant, accurate, bulletproof way to override management commands. A new ticket regarding that would be most welcome (especially if it has good ideas!)


comment:8 Changed 7 years ago by Jacob

Oops, that was me. Sorry.

Version 0, edited 7 years ago by Jacob (next)

comment:9 Changed 7 years ago by Russell Keith-Magee

As a side note, the proposed behavior would actually break a bunch of really useful features, including the way that static media is served by the runserver.

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