Opened 8 years ago

Last modified 8 years ago

#27522 closed Bug

./manage runserver --nostatic doesn't return a traceback — at Version 2

Reported by: Jeroen van Veen Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Normal Keywords: runserver nostatic
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Jeroen van Veen)

When running ./manage runserver --nostatic, I expect a traceback to be returned when
a syntax error occurs, and I expect the autoreloader still to be available. Instead, the
runserver command exits like:

usage: manage.py runserver [-h] [--version] [-v {0,1,2,3}]
                           [--settings SETTINGS] [--pythonpath PYTHONPATH]
                           [--traceback] [--no-color] [--ipv6] [--nothreading]
                           [--noreload]
                           [addrport]
manage.py runserver: error: unrecognized arguments: --nostatic

Change History (2)

comment:1 by Jeroen van Veen, 8 years ago

This is a workaround:

--- django/core/management/__init__.py.orig	2016-11-22 09:58:38.806209538 +0100
+++ django/core/management/__init__.py	2016-11-22 10:10:00.229652313 +0100
@@ -323,6 +323,10 @@
                     apps.all_models = defaultdict(OrderedDict)
                     apps.app_configs = OrderedDict()
                     apps.apps_ready = apps.models_ready = apps.ready = True
+                    # Execute the runserver command, but strip off additional
+                    # parameters that cause the argument parser to fail.
+                    self.fetch_command(subcommand).run_from_argv(self.argv[0:2])
+                    return
 
             # In all other cases, django.setup() is required to succeed.
             else:
Last edited 8 years ago by Jeroen van Veen (previous) (diff)

comment:2 by Jeroen van Veen, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top