Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#9167 closed (wontfix)

shutdown_message option missing in

Reported by: jjackson Owned by: nobody
Component: 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: UI/UX:


Changeset 5911 added a shutdown_message option in, 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/ runserver --noreload --shutdown_message 'Shutdown message for server.' 
Usage: mysite/ runserver [options] [optional port number, or ipaddr:port]

Starts a lightweight Web server for development.

mysite/ 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/ 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
Quit the server with CONTROL-C.
^CShutdown message for server.
Exception: <type 'exceptions.SystemExit'>

Change History (7)

comment:1 Changed 8 years ago by jjackson

Has patch: set
Needs tests: set

To fix the problem of the Control-C, change the inner_run method:

            except KeyboardInterrupt:
                if shutdown_message:
                    print '\n'+shutdown_message

comment:2 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:3 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by Russell Keith-Magee

Component: runserver

comment:5 Changed 8 years ago by Jacob

Resolution: wontfix
Status: newclosed

Looking back at [5911], it's obvious from the next commit ([5912]) that this bit was intended for internal use -- it's used by the testserver command. I don't see the point on making this a public API.

comment:6 Changed 8 years ago by jjackson

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....

comment:7 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top