mirror of https://github.com/django/django.git
Fixed #32296 -- Added --skip-checks option to runserver command.
This commit is contained in:
parent
e8b4f23115
commit
34aa4f1997
|
@ -51,6 +51,10 @@ class Command(BaseCommand):
|
||||||
'--noreload', action='store_false', dest='use_reloader',
|
'--noreload', action='store_false', dest='use_reloader',
|
||||||
help='Tells Django to NOT use the auto-reloader.',
|
help='Tells Django to NOT use the auto-reloader.',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--skip-checks', action='store_true',
|
||||||
|
help='Skip system checks.',
|
||||||
|
)
|
||||||
|
|
||||||
def execute(self, *args, **options):
|
def execute(self, *args, **options):
|
||||||
if options['no_color']:
|
if options['no_color']:
|
||||||
|
@ -114,7 +118,8 @@ class Command(BaseCommand):
|
||||||
shutdown_message = options.get('shutdown_message', '')
|
shutdown_message = options.get('shutdown_message', '')
|
||||||
quit_command = 'CTRL-BREAK' if sys.platform == 'win32' else 'CONTROL-C'
|
quit_command = 'CTRL-BREAK' if sys.platform == 'win32' else 'CONTROL-C'
|
||||||
|
|
||||||
self.stdout.write("Performing system checks...\n\n")
|
if not options['skip_checks']:
|
||||||
|
self.stdout.write('Performing system checks...\n\n')
|
||||||
self.check(display_num_errors=True)
|
self.check(display_num_errors=True)
|
||||||
# Need to check migrations here, so can't use the
|
# Need to check migrations here, so can't use the
|
||||||
# requires_migrations_check attribute.
|
# requires_migrations_check attribute.
|
||||||
|
|
|
@ -968,7 +968,8 @@ more robust change detection, and a reduction in power usage. Django supports
|
||||||
When you start the server, and each time you change Python code while the
|
When you start the server, and each time you change Python code while the
|
||||||
server is running, the system check framework will check your entire Django
|
server is running, the system check framework will check your entire Django
|
||||||
project for some common errors (see the :djadmin:`check` command). If any
|
project for some common errors (see the :djadmin:`check` command). If any
|
||||||
errors are found, they will be printed to standard output.
|
errors are found, they will be printed to standard output. You can use the
|
||||||
|
``--skip-checks`` option to skip running system checks.
|
||||||
|
|
||||||
You can run as many concurrent servers as you want, as long as they're on
|
You can run as many concurrent servers as you want, as long as they're on
|
||||||
separate ports by executing ``django-admin runserver`` more than once.
|
separate ports by executing ``django-admin runserver`` more than once.
|
||||||
|
@ -1006,6 +1007,10 @@ multithreaded by default.
|
||||||
Uses IPv6 for the development server. This changes the default IP address from
|
Uses IPv6 for the development server. This changes the default IP address from
|
||||||
``127.0.0.1`` to ``::1``.
|
``127.0.0.1`` to ``::1``.
|
||||||
|
|
||||||
|
.. versionchanged:: 4.0
|
||||||
|
|
||||||
|
Support for the ``--skip-checks`` option was added.
|
||||||
|
|
||||||
Examples of using different ports and addresses
|
Examples of using different ports and addresses
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,8 @@ Logging
|
||||||
Management Commands
|
Management Commands
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
* ...
|
* The :djadmin:`runserver` management command now supports the
|
||||||
|
:option:`--skip-checks` option.
|
||||||
|
|
||||||
Migrations
|
Migrations
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
|
@ -1313,6 +1313,29 @@ class ManageRunserver(SimpleTestCase):
|
||||||
# You have # ...
|
# You have # ...
|
||||||
self.assertIn('unapplied migration(s)', self.output.getvalue())
|
self.assertIn('unapplied migration(s)', self.output.getvalue())
|
||||||
|
|
||||||
|
@mock.patch('django.core.management.commands.runserver.run')
|
||||||
|
@mock.patch('django.core.management.base.BaseCommand.check_migrations')
|
||||||
|
@mock.patch('django.core.management.base.BaseCommand.check')
|
||||||
|
def test_skip_checks(self, mocked_check, *mocked_objects):
|
||||||
|
call_command(
|
||||||
|
'runserver',
|
||||||
|
use_reloader=False,
|
||||||
|
skip_checks=True,
|
||||||
|
stdout=self.output,
|
||||||
|
)
|
||||||
|
self.assertNotIn('Performing system checks...', self.output.getvalue())
|
||||||
|
mocked_check.assert_not_called()
|
||||||
|
|
||||||
|
self.output.truncate(0)
|
||||||
|
call_command(
|
||||||
|
'runserver',
|
||||||
|
use_reloader=False,
|
||||||
|
skip_checks=False,
|
||||||
|
stdout=self.output,
|
||||||
|
)
|
||||||
|
self.assertIn('Performing system checks...', self.output.getvalue())
|
||||||
|
mocked_check.assert_called()
|
||||||
|
|
||||||
|
|
||||||
class ManageRunserverMigrationWarning(TestCase):
|
class ManageRunserverMigrationWarning(TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue