Some manage.py
commands take Django applications as arguments. Sometimes I want to use these commands, but can't remember the name of the application. Is there a way to get manage.py to provide a such a list?
Asked
Active
Viewed 1.0k times
6

Ciro Santilli OurBigBook.com
- 347,512
- 102
- 1,199
- 985

Casebash
- 114,675
- 90
- 247
- 350
-
1--help does not work? – NullSpace Feb 05 '14 at 01:30
1 Answers
9
not ready made, but you can pipe:
$ echo 'import settings; settings.INSTALLED_APPS' | ./manage.py shell
...
>>> ('django.contrib.auth', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sites'...]
or write a small custom command:
import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
print settings.INSTALLED_APPS
or in a more generic way:
import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
print vars(settings)[args[0]]
$ ./manage.py get_settings INSTALLED_APPS
('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.sites', ...]
$ ./manage.py get_settings TIME_ZONE
America/Chicago

Guy Gavriely
- 11,228
- 6
- 27
- 42