Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#16599 closed Bug (wontfix)

Management commands are collected in the wrong order

Reported by: vanschelven 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 aaugustin 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by anonymous

  • Component changed from Uncategorized to Core (Management commands)
  • milestone set to 1.4
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to fixed
  • Status changed from new to closed
  • Type changed from Uncategorized to Bug

comment:4 Changed 5 years ago by aaugustin

  • milestone 1.4 deleted

Revert spam :(

Changed 5 years ago by aaugustin

comment:5 Changed 5 years ago by vanschelven

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:6 Changed 5 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Design 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 5 years ago by anonymous

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

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 5 years ago by jacob

Oops, that was me. Sorry.

Last edited 5 years ago by jacob (previous) (diff)

comment:9 Changed 5 years ago by russellm

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