How to list all installed apps with manage.py in Django?

django

Solution

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 

Problem

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?

Original source