Improved runserver to display 'CONTROL-C' vs. 'CTRL-BREAK' based on the current platform

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2852 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-05-06 03:29:22 +00:00
parent eb4bbbb6f3
commit 058ab898b0
1 changed files with 2 additions and 1 deletions

View File

@ -970,13 +970,14 @@ def runserver(addr, port):
if not port.isdigit(): if not port.isdigit():
sys.stderr.write(style.ERROR("Error: %r is not a valid port number.\n" % port)) sys.stderr.write(style.ERROR("Error: %r is not a valid port number.\n" % port))
sys.exit(1) sys.exit(1)
quit_command = sys.platform == 'win32' and 'CTRL-BREAK' or 'CONTROL-C'
def inner_run(): def inner_run():
from django.conf import settings from django.conf import settings
print "Validating models..." print "Validating models..."
validate() validate()
print "\nDjango version %s, using settings %r" % (get_version(), settings.SETTINGS_MODULE) print "\nDjango version %s, using settings %r" % (get_version(), settings.SETTINGS_MODULE)
print "Development server is running at http://%s:%s/" % (addr, port) print "Development server is running at http://%s:%s/" % (addr, port)
print "Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows)." print "Quit the server with %s." % quit_command
try: try:
run(addr, int(port), AdminMediaHandler(WSGIHandler())) run(addr, int(port), AdminMediaHandler(WSGIHandler()))
except WSGIServerException, e: except WSGIServerException, e: