mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
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
This commit is contained in:
@@ -4,6 +4,8 @@ from optparse import make_option
|
||||
|
||||
class Command(BaseCommand):
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option('--noinput', action='store_false', dest='interactive', default=True,
|
||||
help='Tells Django to NOT prompt the user for input of any kind.'),
|
||||
make_option('--addrport', action='store', dest='addrport',
|
||||
type='string', default='',
|
||||
help='port number or ipaddr:port to run the server on'),
|
||||
@@ -18,10 +20,11 @@ class Command(BaseCommand):
|
||||
from django.db import connection
|
||||
|
||||
verbosity = int(options.get('verbosity', 1))
|
||||
interactive = options.get('interactive', True)
|
||||
addrport = options.get('addrport')
|
||||
|
||||
# Create a test database.
|
||||
db_name = connection.creation.create_test_db(verbosity=verbosity)
|
||||
db_name = connection.creation.create_test_db(verbosity=verbosity, autoclobber=not interactive)
|
||||
|
||||
# Import the fixture data into the test database.
|
||||
call_command('loaddata', *fixture_labels, **{'verbosity': verbosity})
|
||||
|
||||
Reference in New Issue
Block a user