Changeset 539
- Timestamp:
- 08/19/05 16:23:56 (3 years ago)
- Files:
-
- django/trunk/django/bin/django-admin.py (modified) (1 diff)
- django/trunk/django/core/management.py (modified) (4 diffs)
- django/trunk/django/core/servers/basehttp.py (modified) (1 diff)
- django/trunk/docs/django-admin.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/bin/django-admin.py
r503 r539 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 try: 94 addr, port = args[1].split(':') 95 except ValueError: 96 addr, port = '', args[1] 97 ACTION_MAPPING[action](addr, port) 94 98 else: 95 99 from django.core import meta django/trunk/django/core/management.py
r509 r539 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 if not addr: 551 addr = '127.0.0.1' 550 552 if not port.isdigit(): 551 553 sys.stderr.write("Error: %r is not a valid port number.\n" % port) … … 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. … … 565 567 13: "You don't have permission to access that port.", 566 568 98: "That port is already in use.", 569 99: "That IP address can't be assigned-to.", 567 570 } 568 571 try: … … 576 579 from django.utils import autoreload 577 580 autoreload.main(inner_run) 578 runserver.args = '[optional port number ]'581 runserver.args = '[optional port number, or ipaddr:port]' django/trunk/django/core/servers/basehttp.py
r491 r539 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) django/trunk/docs/django-admin.txt
r535 r539 81 81 Executes the equivalent of ``sqlall`` for the given app(s). 82 82 83 runserver [optional port number ]84 -------------------------------- 83 runserver [optional port number, or ipaddr:port] 84 ------------------------------------------------ 85 85 86 86 Starts a lightweight development Web server on the local machine. By default, 87 the server runs on port 8000. You can pass in a port number explicitly. 87 the server runs on port 8000 on the IP address 127.0.0.1. You can pass in an 88 IP address and port number explicitly. 88 89 89 90 If you run this script as a user with normal privileges (recommended), you … … 103 104 You can run as many servers as you want, as long as they're on separate ports. 104 105 Just execute ``django-admin.py runserver`` more than once. 106 107 Examples: 108 ~~~~~~~~~ 109 110 Port 7000 on IP address 127.0.0.1:: 111 112 django-admin.py runserver 7000 113 114 Port 7000 on IP address 1.2.3.4:: 115 116 django-admin.py runserver 1.2.3.4:7000 105 117 106 118 sql [app app ...]
