Skip to content

Commit

Permalink
Added shutdown_message to runserver command -- a hook for specifying …
Browse files Browse the repository at this point in the history
…a message to display after the server is shut down

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5911 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Aug 16, 2007
1 parent 49c438f commit a5400cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions django/core/management/commands/runserver.py
Expand Up @@ -31,6 +31,7 @@ def handle(self, addrport='', *args, **options):


use_reloader = options.get('use_reloader', True) use_reloader = options.get('use_reloader', True)
admin_media_dir = options.get('admin_media_dir', '') admin_media_dir = options.get('admin_media_dir', '')
shutdown_message = options.get('shutdown_message', '')
quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C' quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C'


def inner_run(): def inner_run():
Expand Down Expand Up @@ -59,6 +60,8 @@ def inner_run():
# Need to use an OS exit because sys.exit doesn't work in a thread # Need to use an OS exit because sys.exit doesn't work in a thread
os._exit(1) os._exit(1)
except KeyboardInterrupt: except KeyboardInterrupt:
if shutdown_message:
print shutdown_message
sys.exit(0) sys.exit(0)
if use_reloader: if use_reloader:
from django.utils import autoreload from django.utils import autoreload
Expand Down

0 comments on commit a5400cf

Please sign in to comment.