Skip to content

Commit 0dce7b6

Browse files
committed
Fixed #12619 -- Added support for the --noinput flag to testserver. Thanks to clouserw for the suggestion, and darkrho for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13365 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent 6ab3fea commit 0dce7b6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

django/core/management/commands/testserver.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
class 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'),
@@ -18,10 +20,11 @@ def handle(self, *fixture_labels, **options):
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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,6 @@ with an appropriate extension (e.g. ``json`` or ``xml``). See the
804804
documentation for ``loaddata`` for details on the specification of fixture
805805
data files.
806806

807-
--noinput
808-
~~~~~~~~~
809807
The :djadminopt:`--noinput` option may be provided to suppress all user
810808
prompts.
811809

@@ -889,6 +887,11 @@ To run on 1.2.3.4:7000 with a ``test`` fixture::
889887

890888
django-admin.py testserver --addrport 1.2.3.4:7000 test
891889

890+
.. versionadded:: 1.3
891+
892+
The :djadminopt:`--noinput` option may be provided to suppress all user
893+
prompts.
894+
892895
validate
893896
--------
894897

0 commit comments

Comments
 (0)