mirror of https://github.com/django/django.git
Improved 'django-admin runserver' so that it explicitly tells you how to stop it. Also trapped KeyboardInterrupt so stopping it doesn't give an ugly traceback.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@264 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
03c436bf61
commit
304b08e325
|
@ -425,6 +425,7 @@ def runserver(port):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print "Starting server on port %s with settings module %r." % (port, SETTINGS_MODULE)
|
print "Starting server on port %s with settings module %r." % (port, SETTINGS_MODULE)
|
||||||
print "Go to http://127.0.0.1:%s/ for Django." % port
|
print "Go to http://127.0.0.1:%s/ for Django." % port
|
||||||
|
print "Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows)."
|
||||||
try:
|
try:
|
||||||
run(int(port), AdminMediaHandler(WSGIHandler()))
|
run(int(port), AdminMediaHandler(WSGIHandler()))
|
||||||
except WSGIServerException, e:
|
except WSGIServerException, e:
|
||||||
|
@ -439,4 +440,6 @@ def runserver(port):
|
||||||
error_text = str(e)
|
error_text = str(e)
|
||||||
sys.stderr.write("Error: %s\n" % error_text)
|
sys.stderr.write("Error: %s\n" % error_text)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sys.exit(0)
|
||||||
runserver.args = '[optional port number]'
|
runserver.args = '[optional port number]'
|
||||||
|
|
Loading…
Reference in New Issue