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
--
Ticket URL: <https://code.djangoproject.com/ticket/27522>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Jeroen van Veen):
This is a workaround:
{{{
--- __init__.py.orig 2016-11-22 09:58:38.806209538 +0100
+++ __init__.py 2016-11-22 09:58:47.656120244 +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:
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:1>
Old description:
> 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
New description:
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
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:2>
Comment (by Jeroen van Veen):
Please let me know if it needs some more work! :)
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:3>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:4>
* version: 1.10 => 1.8
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:5>
* keywords: => runserver nostatic
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:6>
* version: 1.8 => master
Old description:
> 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
> }}}
New description:
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
}}}
Ticket: https://github.com/wearespindle/django/tree/ticket_27522
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:7>
Comment (by Tim Graham):
I can reproduce the problem. Without taking a closer look, I'm not sure
about the solution. If you could write a test, that would certainly help.
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:8>
* has_patch: 0 => 1
* needs_tests: 0 => 1
Old description:
> 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
> }}}
>
> Ticket: https://github.com/wearespindle/django/tree/ticket_27522
New description:
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
}}}
--
Comment:
[https://github.com/django/django/pull/7595 PR] (currently without tests)
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:9>
* needs_tests: 1 => 0
Old description:
> 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
> }}}
New description:
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
}}}
Ticket: https://github.com/wearespindle/django/tree/ticket_27522
--
Comment:
I'm trying to figure out where this test should be placed.
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:10>
* needs_tests: 0 => 1
Comment:
Some tests for `runserver` are in `admin_scripts/tests.py`. It might be
infeasible to test this (for example,
fe6ddb837d18bd4e71cd22fc18272d31478b19f2 lacked tests) but it would be
nice to try.
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:11>
Comment (by Tim Graham):
Now I'm having trouble reproducing the issue. I'm using the tutorial
project and editing a syntax error in `views.py`. I see the error in the
runserver console output, then edit `views.py` to fix the mistake the the
server reloads. Do you have any more specific steps? You set the version
1.8 -- are you also reproducing the issue on master?
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:12>
* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin
Comment:
Steps to reproduce: modify a Django project to have a syntax error and run
`runserver --nostatic`. You should see the `SyntaxError` traceback (after
this fix) rather than `manage.py runserver: error: unrecognized arguments:
--nostatic`.
I don't think it's feasible to write a test for this so I'll commit the
change without one.
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:13>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ed4264c5a44f01a626114e82240c977889e4a972" ed4264c5]:
{{{
#!CommitTicketReference repository=""
revision="ed4264c5a44f01a626114e82240c977889e4a972"
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.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27522#comment:14>