Django

Code

Changeset 6075

Show
Ignore:
Timestamp:
09/09/07 16:57:59 (11 months ago)
Author:
adrian
Message:

Fixed #5369 -- Refactored the django-admin.py help system, allowing each subcommand to register its own options. Thanks for the patch, Todd O'Bryan

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management/base.py

    r6028 r6075  
     1import django 
    12from django.core.exceptions import ImproperlyConfigured 
    23from django.core.management.color import color_style 
     4import itertools 
     5from optparse import make_option, OptionParser 
    36import sys 
    47import os 
     8from traceback import print_exc 
    59 
    610class CommandError(Exception): 
     
    913class BaseCommand(object): 
    1014    # Metadata about this command. 
     15    option_list = ( 
     16        make_option('--settings', 
     17            help='The Python path to a settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.'), 
     18        make_option('--pythonpath', 
     19            help='A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".'), 
     20    ) 
    1121    help = '' 
    1222    args = '' 
     
    1929    def __init__(self): 
    2030        self.style = color_style() 
     31 
     32    def get_version(self): 
     33        """ 
     34        Returns the Django version, which should be correct for all built-in 
     35        Django commands. User-supplied commands should override this method. 
     36        """ 
     37        return django.get_version() 
     38 
     39    def usage(self): 
     40        usage = '%prog [options] ' + self.args 
     41        if self.help: 
     42            return '%s\n\n%s' % (usage, self.help) 
     43        else: 
     44            return usage 
     45 
     46    def create_parser(self, prog_name): 
     47        return OptionParser(prog=prog_name, 
     48                            usage=self.usage(), 
     49                            version=self.get_version(), 
     50                            option_list=self.option_list) 
     51 
     52    def print_help(self, args): 
     53        parser = self.create_parser(args[0]) 
     54        parser.print_help() 
     55 
     56    def run(self, args): 
     57        parser = self.create_parser(args[0]) 
     58        (options, args) = parser.parse_args(args[1:]) 
     59        if options.settings: 
     60            os.environ['DJANGO_SETTINGS_MODULE'] = options.settings 
     61        if options.pythonpath: 
     62            sys.path.insert(0, options.pythonpath) 
     63        try: 
     64            self.execute(*args, **options.__dict__) 
     65        except Exception, e: 
     66            print_exc() 
     67            parser.print_usage() 
    2168 
    2269    def execute(self, *args, **options): 
     
    70117 
    71118class AppCommand(BaseCommand): 
    72     args = '[appname ...]
     119    args = '<appname appname ...>
    73120 
    74121    def handle(self, *app_labels, **options): 
     
    91138 
    92139class LabelCommand(BaseCommand): 
    93     args = '[label ...]
     140    args = '<label label ...>
    94141    label = 'label' 
    95142 
     
    169216      new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR 
    170217      os.chmod(filename, new_permissions) 
    171  
  • django/trunk/django/core/management/commands/createcachetable.py

    r5967 r6075  
    33class Command(LabelCommand): 
    44    help = "Creates the table needed to use the SQL cache backend." 
    5     args = "[tablename]
     5    args = "<tablename>
    66    label = 'tablename' 
    77 
  • django/trunk/django/core/management/commands/dumpdata.py

    r5898 r6075  
    11from django.core.management.base import BaseCommand, CommandError 
    22 
     3from optparse import make_option 
     4 
    35class Command(BaseCommand): 
     6    option_list = ( 
     7        make_option('--format', default='json', dest='format', 
     8            help='Specifies the output serialization format for fixtures'), 
     9        make_option('--indent', default=None, dest='indent', type='int', 
     10            help='Specifies the indent level to use when pretty-printing output'), 
     11    ) 
    412    help = 'Output the contents of the database as a fixture of the given format.' 
    5     args = '[--format] [--indent] [appname ...]' 
     13    args = '[appname ...]' 
    614 
    715    def handle(self, *app_labels, **options): 
  • django/trunk/django/core/management/commands/flush.py

    r6013 r6075  
    11from django.core.management.base import NoArgsCommand, CommandError 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34 
    45class Command(NoArgsCommand): 
     6    option_list = NoArgsCommand.option_list + ( 
     7        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     8            type='choice', choices=['0', '1', '2'], 
     9            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     10        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     11            help='Tells Django to NOT prompt the user for input of any kind.'), 
     12    ) 
    513    help = "Executes ``sqlflush`` on the current database." 
    6     args = '[--verbosity] [--noinput]' 
    714 
    815    def handle_noargs(self, **options): 
  • django/trunk/django/core/management/commands/loaddata.py

    r5964 r6075  
    11from django.core.management.base import BaseCommand 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34import sys 
    45import os 
     
    1011 
    1112class Command(BaseCommand): 
     13    option_list = BaseCommand.option_list + ( 
     14        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     15            type='choice', choices=['0', '1', '2'], 
     16            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     17    ) 
    1218    help = 'Installs the named fixture(s) in the database.' 
    13     args = "[--verbosity] fixture, fixture, ...
     19    args = "fixture [fixture ...]
    1420 
    1521    def handle(self, *fixture_labels, **options): 
  • django/trunk/django/core/management/commands/reset.py

    r5898 r6075  
    11from django.core.management.base import AppCommand, CommandError 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34 
    45class Command(AppCommand): 
     6    option_list = AppCommand.option_list + ( 
     7        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     8            help='Tells Django to NOT prompt the user for input of any kind.'), 
     9    ) 
    510    help = "Executes ``sqlreset`` for the given app(s) in the current database." 
    6     args = '[--noinput] [appname ...]' 
     11    args = '[appname ...]' 
    712 
    813    output_transaction = True 
  • django/trunk/django/core/management/commands/runfcgi.py

    r5898 r6075  
    1515        from django.core.servers.fastcgi import runfastcgi 
    1616        runfastcgi(args) 
     17         
     18    def usage(self): 
     19        from django.core.servers.fastcgi import FASTCGI_HELP 
     20        return FASTCGI_HELP 
  • django/trunk/django/core/management/commands/runserver.py

    r6022 r6075  
    11from django.core.management.base import BaseCommand, CommandError 
     2from optparse import make_option 
    23import os 
    34import sys 
    45 
    56class Command(BaseCommand): 
     7    option_list = BaseCommand.option_list + ( 
     8        make_option('--noreload', action='store_false', dest='use_reloader', default=True, 
     9            help='Tells Django to NOT use the auto-reloader.'), 
     10        make_option('--adminmedia', dest='admin_media_path', default='', 
     11            help='Specifies the directory from which to serve admin media.'), 
     12    ) 
    613    help = "Starts a lightweight Web server for development." 
    7     args = '[--noreload] [--adminmedia=ADMIN_MEDIA_PATH] [optional port number, or ipaddr:port]' 
     14    args = '[optional port number, or ipaddr:port]' 
    815 
    916    # Validation is called explicitly each time the server is reloaded. 
  • django/trunk/django/core/management/commands/shell.py

    r5903 r6075  
    11from django.core.management.base import NoArgsCommand 
     2from optparse import make_option 
    23 
    34class Command(NoArgsCommand): 
     5    option_list = NoArgsCommand.option_list + ( 
     6        make_option('--plain', action='store_true', dest='plain', 
     7            help='Tells Django to use plain Python, not IPython.'), 
     8    ) 
    49    help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available." 
    5     args = '[--plain]' 
    610 
    711    requires_model_validation = False 
  • django/trunk/django/core/management/commands/syncdb.py

    r5975 r6075  
    11from django.core.management.base import NoArgsCommand 
    22from django.core.management.color import no_style 
     3from optparse import make_option 
    34import sys 
    45 
     
    910 
    1011class Command(NoArgsCommand): 
     12    option_list = NoArgsCommand.option_list + ( 
     13        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     14            type='choice', choices=['0', '1', '2'], 
     15            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     16        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     17            help='Tells Django to NOT prompt the user for input of any kind.'), 
     18    ) 
    1119    help = "Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." 
    12     args = '[--verbosity] [--noinput]' 
    1320 
    1421    def handle_noargs(self, **options): 
  • django/trunk/django/core/management/commands/test.py

    r5913 r6075  
    11from django.core.management.base import BaseCommand 
     2from optparse import make_option 
    23import sys 
    34 
    45class Command(BaseCommand): 
     6    option_list = BaseCommand.option_list + ( 
     7        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     8            type='choice', choices=['0', '1', '2'], 
     9            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     10        make_option('--noinput', action='store_false', dest='interactive', default=True, 
     11            help='Tells Django to NOT prompt the user for input of any kind.'), 
     12    ) 
    513    help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.' 
    6     args = '[--verbosity] [--noinput] [appname ...]' 
     14    args = '[appname ...]' 
    715 
    816    requires_model_validation = False 
  • django/trunk/django/core/management/commands/testserver.py

    r5912 r6075  
    11from django.core.management.base import BaseCommand 
    22 
     3from optparse import make_option 
     4 
    35class Command(BaseCommand): 
     6    option_list = BaseCommand.option_list + ( 
     7        make_option('--verbosity', action='store', dest='verbosity', default='1', 
     8            type='choice', choices=['0', '1', '2'], 
     9            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 
     10    ) 
    411    help = 'Runs a development server with data from the given fixture(s).' 
    512    args = '[fixture ...]' 
  • django/trunk/django/core/management/__init__.py

    r6050 r6075  
    1919    """ 
    2020    Calls the given command, with the given options and args/kwargs. 
    21      
     21 
    2222    This is the primary API you should use for calling specific commands. 
    23      
     23 
    2424    Some examples: 
    2525        call_command('syncdb') 
     
    5353        return dict([(name, load_command_class(name)) for name in names]) 
    5454 
    55     def usage(self): 
     55    def print_help(self, argv): 
    5656        """ 
    57         Returns a usage string, for use with optparse. 
     57        Returns the help message, as a string. 
     58        """ 
     59        prog_name = os.path.basename(argv[0]) 
     60        usage = ['%s <subcommand> [options] [args]' % prog_name] 
     61        usage.append('Django command line tool, version %s' % django.get_version()) 
     62        usage.append("Type '%s help <subcommand>' for help on a specific subcommand." % prog_name) 
     63        usage.append('Available subcommands:') 
     64        commands = self.commands.keys() 
     65        commands.sort() 
     66        for cmd in commands: 
     67            usage.append('  %s' % cmd) 
     68        print '\n'.join(usage) 
    5869 
    59         The string doesn't include the options (e.g., "--verbose"), because 
    60         optparse puts those in automatically. 
     70    def fetch_command(self, subcommand, command_name): 
    6171        """ 
    62         usage = ["%prog command [options]\nactions:"] 
    63         commands = self.commands.items() 
    64         commands.sort() 
    65         for name, cmd in commands: 
    66             usage.append('  %s %s' % (name, cmd.args)) 
    67             usage.extend(textwrap.wrap(cmd.help, initial_indent='    ', subsequent_indent='    ')) 
    68             usage.append('') 
    69         return '\n'.join(usage[:-1]) # Cut off the last list element, an empty space. 
     72        Tries to fetch the given subcommand, printing a message with the 
     73        appropriate command called from the command line (usually 
     74        django-admin.py or manage.py) if it can't be found. 
     75        """ 
     76        try: 
     77            return self.commands[subcommand] 
     78        except KeyError: 
     79            sys.stderr.write("Unknown command: %r\nType '%s help' for usage.\n" % (subcommand, command_name)) 
     80            sys.exit(1) 
    7081 
    7182    def execute(self, argv=None): 
    7283        """ 
    73         Parses the given argv from the command line, determines which command 
    74         to run and runs the command
     84        Figures out which command is being run (the first arg), creates a parser 
     85        appropriate to that command, and runs it
    7586        """ 
    7687        if argv is None: 
    7788            argv = sys.argv 
     89        try: 
     90            command_name = argv[1] 
     91        except IndexError: 
     92            sys.stderr.write("Type '%s help' for usage.\n" % os.path.basename(argv[0])) 
     93            sys.exit(1) 
    7894 
    79         # Create the parser object and parse the command-line args. 
    80         # TODO: Ideally each Command class would register its own options for 
    81         # add_option(), but we'd need to figure out how to allow for multiple 
    82         # Commands using the same options. The optparse library gets in the way 
    83         # by checking for conflicts: 
    84         # http://docs.python.org/lib/optparse-conflicts-between-options.html 
    85         parser = OptionParser(usage=self.usage(), version=get_version()) 
    86         parser.add_option('--settings', 
    87             help='The Python path to a settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.') 
    88         parser.add_option('--pythonpath', 
    89             help='A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".') 
    90         parser.add_option('--plain', action='store_true', dest='plain', 
    91             help='When using "shell": Tells Django to use plain Python, not IPython.') 
    92         parser.add_option('--noinput', action='store_false', dest='interactive', default=True, 
    93             help='Tells Django to NOT prompt the user for input of any kind.') 
    94         parser.add_option('--noreload', action='store_false', dest='use_reloader', default=True, 
    95             help='When using "runserver": Tells Django to NOT use the auto-reloader.') 
    96         parser.add_option('--format', default='json', dest='format', 
    97             help='Specifies the output serialization format for fixtures') 
    98         parser.add_option('--indent', default=None, dest='indent', 
    99             type='int', help='Specifies the indent level to use when pretty-printing output') 
    100         parser.add_option('--verbosity', action='store', dest='verbosity', default='1', 
    101             type='choice', choices=['0', '1', '2'], 
    102             help='Verbosity level; 0=minimal output, 1=normal output, 2=all output') 
    103         parser.add_option('--adminmedia', dest='admin_media_path', default='', 
    104             help='When using "runserver": Specifies the directory from which to serve admin media.') 
    105         options, args = parser.parse_args(argv[1:]) 
    106  
    107         # If the 'settings' or 'pythonpath' options were submitted, activate those. 
    108         if options.settings: 
    109             os.environ['DJANGO_SETTINGS_MODULE'] = options.settings 
    110         if options.pythonpath: 
    111             sys.path.insert(0, options.pythonpath) 
    112  
    113         # Run the appropriate command. 
    114         try: 
    115             command_name = args[0] 
    116         except IndexError: 
    117             sys.stderr.write("Type '%s --help' for usage.\n" % os.path.basename(argv[0])) 
    118             sys.exit(1) 
    119         try: 
    120             command = self.commands[command_name] 
    121         except KeyError: 
    122             sys.stderr.write("Unknown command: %r\nType '%s --help' for usage.\n" % (command_name, os.path.basename(argv[0]))) 
    123             sys.exit(1) 
    124         command.execute(*args[1:], **options.__dict__) 
     95        if command_name == 'help': 
     96            if len(argv) > 2: 
     97                self.fetch_command(argv[2], argv[0]).print_help(argv[2:]) 
     98            else: 
     99                self.print_help(argv) 
     100        # Special-cases: We want 'django-admin.py --version' and 
     101        # 'django-admin.py --help' to work, for backwards compatibility. 
     102        elif argv[1:] == ['--version']: 
     103            print django.get_version() 
     104        elif argv[1:] == ['--help']: 
     105            self.print_help(argv) 
     106        else: 
     107            self.fetch_command(command_name, argv[0]).run(argv[1:]) 
    125108 
    126109class ProjectManagementUtility(ManagementUtility): 
  • django/trunk/django/core/servers/fastcgi.py

    r4902 r6075  
    1818__all__ = ["runfastcgi"] 
    1919 
    20 FASTCGI_HELP = r"""runfcgi: 
     20FASTCGI_HELP = r""" 
    2121  Run this project as a fastcgi (or some other protocol supported 
    2222  by flup) application. To do this, the flup package from 
    2323  http://www.saddi.com/software/flup/ is required. 
    2424 
    25 Usage: 
    26    django-admin.py runfcgi --settings=yourproject.settings [fcgi settings] 
    27    manage.py runfcgi [fcgi settings] 
     25   runfcgi [options] [fcgi settings] 
    2826 
    2927Optional Fcgi settings: (setting=value) 
  • django/trunk/docs/django-admin.txt

    r6050 r6075  
    3636===== 
    3737 
    38 ``django-admin.py action [options]`` 
    39  
    40 ``manage.py action [options]`` 
    41  
    42 ``action`` should be one of the actions listed in this document. ``options``, 
    43 which is optional, should be zero or more of the options listed in this 
    44 document. 
    45  
    46 Run ``django-admin.py --help`` to display a help message that includes a terse 
    47 list of all available actions and options. 
    48  
    49 Most actions take a list of ``appname``s. An ``appname`` is the basename of the 
    50 package containing your models. For example, if your ``INSTALLED_APPS`` 
    51 contains the string ``'mysite.blog'``, the ``appname`` is ``blog``. 
    52  
    53 Available actions 
    54 ================= 
    55  
    56 adminindex [appname appname ...] 
     38``django-admin.py <subcommand> [options]`` 
     39 
     40``manage.py <subcommand> [options]`` 
     41 
     42``subcommand`` should be one of the subcommands listed in this document. 
     43``options``, which is optional, should be zero or more of the options available 
     44for the given subcommand. 
     45 
     46Getting runtime help 
     47-------------------- 
     48 
     49In Django 0.96, run ``django-admin.py --help`` to display a help message that 
     50includes a terse list of all available subcommands and options. 
     51 
     52In the Django development version, run ``django-admin.py help`` to display a 
     53list of all available subcommands. Run ``django-admin.py help <subcommand>`` 
     54to display a description of the given subcommand and a list of its available 
     55options. 
     56 
     57App names 
     58--------- 
     59 
     60Many subcommands take a list of "app names." An "app name" is the basename of 
     61the package containing your models. For example, if your ``INSTALLED_APPS`` 
     62contains the string ``'mysite.blog'``, the app name is ``blog``. 
     63 
     64Determining the version 
     65----------------------- 
     66 
     67Run ``django-admin.py --version`` to display the current Django version. 
     68 
     69Examples of output:: 
     70 
     71        0.95 
     72    0.96 
     73    0.97-pre-SVN-6069 
     74 
     75Available subcommands 
     76===================== 
     77 
     78adminindex <appname appname ...> 
    5779-------------------------------- 
    5880 
    59 Prints the admin-index template snippet for the given appnames
     81Prints the admin-index template snippet for the given app name(s)
    6082 
    6183Use admin-index template snippets if you want to customize the look and feel of 
     
    6486.. _Tutorial 2: ../tutorial02/ 
    6587 
    66 createcachetable [tablename] 
     88createcachetable <tablename> 
    6789---------------------------- 
    6890 
    6991Creates a cache table named ``tablename`` for use with the database cache 
    70 backend. See the `cache documentation`_ for more information. 
     92backend. See the `cache documentation`_ for more information. 
    7193 
    7294.. _cache documentation: ../cache/ 
     
    101123if you're ever curious to see the full list of defaults. 
    102124 
    103 dumpdata [appname appname ...] 
     125dumpdata <appname appname ...> 
    104126------------------------------ 
    105127 
    106 Output to standard output all data in the database associated with the named 
     128Outputs to standard output all data in the database associated with the named 
    107129application(s). 
    108130 
    109 By default, the database will be dumped in JSON format. If you want the output 
    110 to be in another format, use the ``--format`` option (e.g., ``format=xml``). 
    111 You may specify any Django serialization backend (including any user specified 
    112 serialization backends named in the ``SERIALIZATION_MODULES`` setting). The 
    113 ``--indent`` option can be used to pretty-print the output. 
    114  
    115131If no application name is provided, all installed applications will be dumped. 
    116132 
    117133The output of ``dumpdata`` can be used as input for ``loaddata``. 
     134 
     135--format 
     136~~~~~~~~ 
     137 
     138By default, ``dumpdata`` will format its output in JSON, but you can use the 
     139``--format`` option to specify another format. Currently supported formats are 
     140listed in `Serialization formats`_. 
     141 
     142Example usage:: 
     143 
     144    django-admin.py dumpdata --format=xml 
     145 
     146.. _Serialization formats: ../serialization/#Serialization-formats 
     147 
     148--indent 
     149~~~~~~~~ 
     150 
     151By default, ``dumpdata`` will output all data on a single line. This isn't easy 
     152for humans to read, so you can use the ``--indent`` option to pretty-print the 
     153output with a number of indentation spaces. 
     154 
     155Example usage:: 
     156 
     157    django-admin.py dumpdata --indent=4 
    118158 
    119159flush 
    120160----- 
    121161 
    122 Return the database to the state it was in immediately after syncdb was 
     162Returns the database to the state it was in immediately after syncdb was 
    123163executed. This means that all data will be removed from the database, any 
    124164post-synchronization handlers will be re-executed, and the ``initial_data`` 
     
    131171tables that are represented by Django models and are activated in 
    132172``INSTALLED_APPS``. 
     173 
     174--noinput 
     175~~~~~~~~~ 
     176 
     177Use the ``--noinput`` option to suppress all user prompting, such as 
     178"Are you sure?" confirmation messages. This is useful if ``django-admin.py`` 
     179is being executed as an unattended, automated script. 
     180 
     181--verbosity 
     182~~~~~~~~~~~ 
     183 
     184Use ``--verbosity`` to specify the amount of notification and debug information 
     185that ``django-admin.py`` should print to the console. 
     186 
     187        * ``0`` means no input. 
     188        * ``1`` means normal input (default). 
     189        * ``2`` means verbose input. 
     190 
     191Example usage:: 
     192 
     193    django-admin.py flush --verbosity=2 
    133194 
    134195inspectdb 
     
    173234only works in PostgreSQL and with certain types of MySQL tables. 
    174235 
    175 loaddata [fixture fixture ...] 
     236loaddata <fixture fixture ...> 
    176237------------------------------ 
    177238 
    178239Searches for and loads the contents of the named fixture into the database. 
    179240 
    180 A *Fixture* is a collection of files that contain the serialized contents of 
    181 the database. Each fixture has a unique name; however, the files that 
    182 comprise the fixture can be distributed over multiple directories, in 
    183 multiple applications. 
     241A *fixture* is a collection of files that contain the serialized contents of 
     242the database. Each fixture has a unique name, and the files that comprise the 
     243fixture can be distributed over multiple directories, in multiple applications. 
    184244 
    185245Django will search in three locations for fixtures: 
     
    241301    defer checking of row constraints until a transaction is committed. 
    242302 
    243 reset [appname appname ...] 
     303--verbosity 
     304~~~~~~~~~~~ 
     305 
     306Use ``--verbosity`` to specify the amount of notification and debug information 
     307that ``django-admin.py`` should print to the console. 
     308 
     309        * ``0`` means no input. 
     310        * ``1`` means normal input (default). 
     311        * ``2`` means verbose input. 
     312 
     313Example usage:: 
     314 
     315    django-admin.py loaddata --verbosity=2 
     316 
     317reset <appname appname ...> 
    244318--------------------------- 
    245319 
    246 Executes the equivalent of ``sqlreset`` for the given appnames. 
     320Executes the equivalent of ``sqlreset`` for the given app name(s). 
     321 
     322--noinput 
     323~~~~~~~~~ 
     324 
     325Use the ``--noinput`` option to suppress all user prompting, such as 
     326"Are you sure?" confirmation messages. This is useful if ``django-admin.py`` 
     327is being executed as an unattended, automated script. 
    247328 
    248329runfcgi [options] 
    249330----------------- 
    250331 
    251 Starts a set of FastCGI processes suitable for use with any web server 
    252 which supports the FastCGI protocol. See the `FastCGI deployment 
     332Starts a set of FastCGI processes suitable for use with any Web server 
     333that supports the FastCGI protocol. See the `FastCGI deployment 
    253334documentation`_ for details. Requires the Python FastCGI module from 
    254335`flup`_. 
     
    290371``0.0.0.0``. 
    291372 
     373--adminmedia 
     374~~~~~~~~~~~~ 
     375 
     376Use the ``--adminmedia`` option to tell Django where to find the various CSS 
     377and JavaScript files for the Django admin interface. Normally, the development 
     378server serves these files out of the Django source tree magically, but you'd 
     379want to use this if you made any changes to those files for your own site. 
     380 
     381Example usage:: 
     382 
     383    django-admin.py runserver --adminmedia=/tmp/new-admin-style/ 
     384 
     385--noreload 
     386~~~~~~~~~~ 
     387 
     388Use the ``--noreload`` option to disable the use of the auto-reloader. This 
     389means any Python code changes you make while the server is running will *not* 
     390take effect if the particular Python modules have already been loaded into 
     391memory. 
     392 
    292393Examples: 
    293394~~~~~~~~~ 
     
    332433.. _IPython: http://ipython.scipy.org/ 
    333434 
    334 sql [appname appname ...] 
     435sql <appname appname ...> 
    335436------------------------- 
    336437 
    337 Prints the CREATE TABLE SQL statements for the given appnames
    338  
    339 sqlall [appname appname ...] 
     438Prints the CREATE TABLE SQL statements for the given app name(s)
     439 
     440sqlall <appname appname ...> 
    340441---------------------------- 
    341442 
    342 Prints the CREATE TABLE and initial-data SQL statements for the given appnames
     443Prints the CREATE TABLE and initial-data SQL statements for the given app name(s)
    343444 
    344445Refer to the description of ``sqlcustom`` for an explanation of how to 
    345446specify initial data. 
    346447 
    347 sqlclear [appname appname ...] 
     448sqlclear <appname appname ...> 
    348449------------------------------ 
    349450 
    350 Prints the DROP TABLE SQL statements for the given appnames
    351  
    352 sqlcustom [appname appname ...] 
     451Prints the DROP TABLE SQL statements for the given app name(s)
     452 
     453sqlcustom <appname appname ...> 
    353454------------------------------- 
    354455 
    355 Prints the custom SQL statements for the given appnames
     456Prints the custom SQL statements for the given app name(s)
    356457 
    357458For each model in each specified app, this command looks for the file 
    358 ``<appname>/sql/<modelname>.sql``, where ``<appname>`` is the given appname and 
     459``<appname>/sql/<modelname>.sql``, where ``<appname>`` is the given app name and 
    359460``<modelname>`` is the model's name in lowercase. For example, if you have an 
    360461app ``news`` that includes a ``Story`` model, ``sqlcustom`` will attempt 
     
    374475Prints the SQL statements that would be executed for the `flush`_ command. 
    375476 
    376 sqlindexes [appname appname ...] 
     477sqlindexes <appname appname ...> 
    377478-------------------------------- 
    378479 
    379 Prints the CREATE INDEX SQL statements for the given appnames
    380  
    381 sqlreset [appname appname ...] 
     480Prints the CREATE INDEX SQL statements for the given app name(s)
     481 
     482sqlreset <appname appname ...> 
    382483------------------------------ 
    383484 
    384 Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given appnames
    385  
    386 sqlsequencereset [appname appname ...] 
     485Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s)
     486 
     487sqlsequencereset <appname appname ...> 
    387488-------------------------------------- 
    388489 
    389 Prints the SQL statements for resetting sequences for the given 
    390 appnames. 
     490Prints the SQL statements for resetting sequences for the given app name(s). 
    391491 
    392492See http://simon.incutio.com/archive/2004/04/21/postgres for more information. 
    393493 
    394 startapp [appname] 
     494startapp <appname> 
    395495------------------ 
    396496 
     
    398498directory. 
    399499 
    400 startproject [projectname] 
     500startproject <projectname> 
    401501-------------------------- 
    402502 
     
    436536data files. 
    437537 
     538--verbosity 
     539~~~~~~~~~~~ 
     540 
     541Use ``--verbosity`` to specify the amount of notification and debug information 
     542that ``django-admin.py`` should print to the console. 
     543 
     544        * ``0`` means no input. 
     545        * ``1`` means normal input (default). 
     546        * ``2`` means verbose input. 
     547 
     548Example usage:: 
     549 
     550    django-admin.py syncdb --verbosity=2 
     551 
     552--noinput 
     553~~~~~~~~~ 
     554 
     555Use the ``--noinput`` option to suppress all user prompting, such as 
     556"Are you sure?" confirmation messages. This is useful if ``django-admin.py`` 
     557is being executed as an unattended, automated script. 
     558 
    438559test 
    439560---- 
    440561 
    441 Discover and run tests for all installed models.  See `Testing Django applications`_ for more information. 
     562Runs tests for all installed models.  See `Testing Django applications`_ 
     563for more information. 
    442564 
    443565.. _testing Django applications: ../testing/ 
    444566 
    445 testserver [fixture fixture ...] 
     567--noinput 
     568~~~~~~~~~ 
     569 
     570Use the ``--noinput`` option to suppress all user prompting, such as 
     571"Are you sure?" confirmation messages. This is useful if ``django-admin.py`` 
     572is being executed as an unattended, automated script. 
     573 
     574--verbosity 
     575~~~~~~~~~~~ 
     576 
     577Use ``--verbosity`` to specify the amount of notification and debug information 
     578that ``django-admin.py`` should print to the console. 
     579 
     580        * ``0`` means no input. 
     581        * ``1`` means normal input (default). 
     582        * ``2`` means verbose input. 
     583 
     584Example usage:: 
     585 
     586    django-admin.py test --verbosity=2 
     587 
     588testserver <fixture fixture ...> 
    446589-------------------------------- 
    447590 
     
    485628.. _unit tests: ../testing/ 
    486629 
     630--verbosity 
     631~~~~~~~~~~~ 
     632 
     633Use ``--verbosity`` to specify the amount of notification and debug information 
     634that ``django-admin.py`` should print to the console. 
     635 
     636        * ``0`` means no input. 
     637        * ``1`` means normal input (default). 
     638        * ``2`` means verbose input. 
     639 
     640Example usage:: 
     641 
     642    django-admin.py testserver --verbosity=2 
     643 
    487644validate 
    488645-------- 
     
    491648and prints validation errors to standard output. 
    492649 
    493 Available options 
    494 ================= 
     650Default options 
     651=============== 
     652 
     653Although some subcommands may allow their own custom options, every subcommand 
     654allows for the following options: 
     655 
     656--pythonpath 
     657------------ 
     658 
     659Example usage:: 
     660 
     661    django-admin.py syncdb --pythonpath='/home/djangoprojects/myproject' 
     662 
     663Adds the given filesystem path to the Python `import search path`_. If this 
     664isn't provided, ``django-admin.py`` will use the ``PYTHONPATH`` environment 
     665variable. 
     666 
     667Note that this option is unnecessary in ``manage.py``, because it takes care of 
     668setting the Python path for you. 
     669 
     670.. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html 
    495671 
    496672--settings 
     
    509685setting ``DJANGO_SETTINGS_MODULE`` for you. 
    510686 
    511 --pythonpath 
    512 ------------ 
    513  
    514 Example usage:: 
    515  
    516     django-admin.py syncdb --pythonpath='/home/djangoprojects/myproject' 
    517  
    518 Adds the given filesystem path to the Python `import search path`_. If this 
    519 isn't provided, ``django-admin.py`` will use the ``PYTHONPATH`` environment 
    520 variable. 
    521  
    522 Note that this option is unnecessary in ``manage.py``, because it takes care of 
    523 setting the Python path for you. 
    524  
    525 .. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html 
    526  
    527 --format 
    528 -------- 
    529  
    530 Example usage:: 
    531  
    532     django-admin.py dumpdata --format=xml 
    533  
    534 Specifies the output format that will be used. The name provided must be the name 
    535 of a registered serializer. 
    536  
    537 --help 
    538 ------ 
    539  
    540 Displays a help message that includes a terse list of all available actions and 
    541 options. 
    542  
    543 --indent 
    544 -------- 
    545  
    546 Example usage:: 
    547  
    548     django-admin.py dumpdata --indent=4 
    549  
    550 Specifies the number of spaces that will be used for indentation when 
    551 pretty-printing output. By default, output will *not* be pretty-printed. 
    552 Pretty-printing will only be enabled if the indent option is provided. 
    553  
    554 --noinput 
    555 --------- 
    556  
    557 Inform django-admin that the user should NOT be prompted for any input. Useful 
    558 if the django-admin script will be executed as an unattended, automated 
    559 script. 
    560  
    561 --noreload 
    562 ---------- 
    563  
    564 Disable the use of the auto-reloader when running the development server. 
    565  
    566 --version 
    567 --------- 
    568  
    569 Displays the current Django version. 
    570  
    571 Example output:: 
    572  
    573     0.9.1 
    574     0.9.1 (SVN) 
    575  
    576 --verbosity 
    577 ----------- 
    578  
    579 Example usage:: 
    580  
    581     django-admin.py syncdb --verbosity=2 
    582  
    583 Verbosity determines the amount of notification and debug information that 
    584 will be printed to the console. '0' is no output, '1' is normal output, 
    585 and ``2`` is verbose output. 
    586  
    587 --adminmedia 
    588 ------------ 
    589  
    590 Example usage:: 
    591  
    592     django-admin.py --adminmedia=/tmp/new-admin-style/ 
    593  
    594 Tells Django where to find the va