Fixed #27522 -- Fixed runserver autoreload when using staticfile's options.
On a SyntaxError, made runserver exit with a stacktrace when using contrib.staticfiles's runserver options such as --nostatic.
This commit is contained in:
parent
6128c1736d
commit
ed4264c5a4
|
@ -326,6 +326,15 @@ class ManagementUtility(object):
|
|||
apps.app_configs = OrderedDict()
|
||||
apps.apps_ready = apps.models_ready = apps.ready = True
|
||||
|
||||
# Remove options not compatible with the built-in runserver
|
||||
# (e.g. options for the contrib.staticfiles' runserver).
|
||||
# Changes here require manually testing as described in
|
||||
# #27522.
|
||||
_parser = self.fetch_command('runserver').create_parser('django', 'runserver')
|
||||
_options, _args = _parser.parse_known_args(self.argv[2:])
|
||||
for _arg in _args:
|
||||
self.argv.remove(_arg)
|
||||
|
||||
# In all other cases, django.setup() is required to succeed.
|
||||
else:
|
||||
django.setup()
|
||||
|
|
Loading…
Reference in New Issue