I've got an issue where there's more than one app trying to override the same management command in a Django project.
INSTALLED_APPS
, or the one that was defined last?For context I'm trying to get django_pdb
(see github) to work more nicely with south
and django.contrib.staticfiles
.
2.5 years later, but in case someone has the same problem and lands here after a google search, I've made a small django app to deal with that case: django-mcmo ('Management Command Multiple Override'), available on pypi. It has limitations but works as expected.
Works with django 1.4 to 1.8 and py 2 and 3, contributions welcome on bitbucket repo.
Easiest answer I'm aware of is: structure your project so you can change one of them and keep a record of your changes so you can apply it to future releases.
For my projects I like to have:
/myproject
/lib
/app1
/app2
/app3
Then explicitly add /lib to the path in setup.py
import os
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
import sys
lib_dir = os.path.join(PROJECT_PATH, 'lib')
if lib_dir not in sys.path[:4]:
sys.path.insert(1, os.path.join(PROJECT_PATH, 'lib'))
I'm probably far more likely than average to take an app, install it, then change 10% of it to work exactly how I want.
The advantage of this is: 1) most dependencies ship with the code and are tracked in GIT 2) no chance for a system wide change to unexpectedly cause bugs in an app if you are running multiple apps from the same machine and 3) Easy to change, with revision history, any and everything in the app.
Not having dove too deeply into south's management commands, and never having used django_pdb, your particular problem might not be solved with the "make a local copy and rename one of them" approach, but I share in case it might.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With