Ticket #360: django-server-addr.2.diff
File django-server-addr.2.diff, 2.7 KB (added by , 19 years ago) |
---|
-
django/bin/django-admin.py
87 87 ACTION_MAPPING[action](name, os.getcwd()) 88 88 elif action == 'runserver': 89 89 if len(args) < 2: 90 addr = '' 90 91 port = '8000' 91 92 else: 92 port = args[1] 93 ACTION_MAPPING[action](port) 93 if args[1].find(':') != -1: 94 addr, port = args[1].split(':') 95 else: 96 addr = '' 97 port = args[1] 98 ACTION_MAPPING[action](addr, port) 94 99 else: 95 100 from django.core import meta 96 101 if action == 'dbcheck': -
django/core/servers/basehttp.py
636 636 start_response(status, headers.items()) 637 637 return output 638 638 639 def run( port, wsgi_handler):640 server_address = ( '', port)639 def run(addr, port, wsgi_handler): 640 server_address = (addr, port) 641 641 httpd = WSGIServer(server_address, WSGIRequestHandler) 642 642 httpd.set_app(wsgi_handler) 643 643 httpd.serve_forever() -
django/core/management.py
543 543 print '%s error%s found.' % (num_errors, num_errors != 1 and 's' or '') 544 544 validate.args = '' 545 545 546 def runserver( port):546 def runserver(addr, port): 547 547 "Starts a lightweight Web server for development." 548 548 from django.core.servers.basehttp import run, AdminMediaHandler, WSGIServerException 549 549 from django.core.handlers.wsgi import WSGIHandler 550 550 if not port.isdigit(): 551 551 sys.stderr.write("Error: %r is not a valid port number.\n" % port) 552 552 sys.exit(1) 553 if addr == '': 554 addr = '127.0.0.1' 553 555 def inner_run(): 554 556 from django.conf.settings import SETTINGS_MODULE 555 557 print "Validating models..." 556 558 validate() 557 559 print "\nStarting server on port %s with settings module %r." % (port, SETTINGS_MODULE) 558 print "Go to http:// 127.0.0.1:%s/ for Django." % port560 print "Go to http://%s:%s/ for Django." % (addr, port) 559 561 print "Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows)." 560 562 try: 561 run( int(port), AdminMediaHandler(WSGIHandler()))563 run(addr, int(port), AdminMediaHandler(WSGIHandler())) 562 564 except WSGIServerException, e: 563 565 # Use helpful error messages instead of ugly tracebacks. 564 566 ERRORS = {