Ticket #12619: testserver_noinput.patch

File testserver_noinput.patch, 1.7 KB (added by Rolando Espinoza La fuente, 14 years ago)

adds --noinput option to testserver command and updates docs

  • django/core/management/commands/testserver.py

    # HG changeset patch
    # Parent e3363b0ff1d2fe8ad742afbf197e3986793beb8c
    diff --git a/django/core/management/commands/testserver.py b/django/core/management/commands/testserver.py
    a b from optparse import make_option  
    44
    55class Command(BaseCommand):
    66    option_list = BaseCommand.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.'),
    79        make_option('--addrport', action='store', dest='addrport',
    810            type='string', default='',
    911            help='port number or ipaddr:port to run the server on'),
    class Command(BaseCommand):  
    1820        from django.db import connection
    1921
    2022        verbosity = int(options.get('verbosity', 1))
     23        interactive = options.get('interactive', True)
    2124        addrport = options.get('addrport')
    2225
    2326        # Create a test database.
    24         db_name = connection.creation.create_test_db(verbosity=verbosity)
     27        db_name = connection.creation.create_test_db(verbosity=verbosity, autoclobber=not interactive)
    2528
    2629        # Import the fixture data into the test database.
    2730        call_command('loaddata', *fixture_labels, **{'verbosity': verbosity})
  • docs/ref/django-admin.txt

    diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
    a b To run on 1.2.3.4:7000 with a ``test`` f  
    889889
    890890    django-admin.py testserver --addrport 1.2.3.4:7000 test
    891891
     892.. versionadded:: development
     893
     894The :djadminopt:`--noinput` option may be provided to suppress all user
     895prompts.
     896
    892897validate
    893898--------
    894899
Back to Top