#9167 closed (wontfix)
shutdown_message option missing in runserver.py
Reported by: | jjackson | Owned by: | nobody |
---|---|---|---|
Component: | django-admin.py runserver | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | jjackson@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Changeset 5911 added a shutdown_message option in runserver.py, but it was never fully implemented. In Ticket #8085, you can see it being used, but it doesn't work because the option isn't included using 'make_option'. Running in 1.0:
LosOlivos: $ python -u mysite/manage.py runserver --noreload --shutdown_message 'Shutdown message for server.' Usage: mysite/manage.py runserver [options] [optional port number, or ipaddr:port] Starts a lightweight Web server for development. mysite/manage.py: error: no such option: --shutdown_message Exception: <type 'exceptions.SystemExit'>
What's missing is the last make_option shown in this code:
class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--noreload', action='store_false', dest='use_reloader', default=True, help='Tells Django to NOT use the auto-reloader.'), make_option('--adminmedia', dest='admin_media_path', default='', help='Specifies the directory from which to serve admin media.'), make_option('--shutdown_message', dest='shutdown_message', default='', help='Specifies a message displayed when shutting down the server.'), )
One thing I'm not sure about is what to do when the message is printed, as the message may need a '\n' before it. What I got was this, with the Control-C and the message run together:
LosOlivos: $ python -u mysite/manage.py runserver --noreload --shutdown_message 'Shutdown message for server.' Validating models... 0 errors found Django version 1.0-final-SVN-unknown, using settings 'mysite.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. ^CShutdown message for server. Exception: <type 'exceptions.SystemExit'>
Change History (7)
comment:1 by , 16 years ago
Has patch: | set |
---|---|
Needs tests: | set |
comment:3 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 16 years ago
Component: | Uncategorized → django-admin.py runserver |
---|
comment:5 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:6 by , 16 years ago
I don't see that this is "obvious from the next commit ([5912]) that this bit was intended for internal use". I use this in an application I wrote for a demo Django Server to send to prospective clients, and it allows me to provide feedback that the server is shutting down. It's being used as shown in Ticket #8085, but it doesn't work the way it's currently configured. It's not as if omitting this is going to keep this hidden.
And, it's not as if the testserver can use the 'shutdown message" option either: the way it is, it's just broken. If you don't want it exposed, you should instead remove it all, as the code doesn't even work as an "internal use" only, whatever that means.
Since I use it personally, I'll just keep adding it back into my projects....
To fix the problem of the Control-C, change the inner_run method: