#396 closed defect (invalid)
djangoadmin.py runserver should be able to listen on all available IPs
Reported by: | mgood | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Tools | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Since [539] the built-in Django server will only listen on 127.0.0.1 if an IP address is not specified. So, if you want to access the Django server from another machine you have to fill in the full IP of the server. I think that by default the server should use the empty string for the IP so that the server listens on all available IP addresses.
Change History (3)
comment:1 by , 19 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 19 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Ok, listening on the loopback is a decent default, but I'd rather not have to type my IP when I'm running the server, plus there's now no way to allow it to listen on all addresses, so "localhost" won't work at the same time as an external IP. The following patch allows specifying the address as "*" which will make the server listen on all IPs.
-
django/core/management.py
549 549 from django.core.handlers.wsgi import WSGIHandler 550 550 if not addr: 551 551 addr = '127.0.0.1' 552 elif addr == '*': 553 addr = '' 552 554 if not port.isdigit(): 553 555 sys.stderr.write("Error: %r is not a valid port number.\n" % port) 554 556 sys.exit(1) … … 557 559 print "Validating models..." 558 560 validate() 559 561 print "\nStarting server on port %s with settings module %r." % (port, SETTINGS_MODULE) 560 print "Go to http://%s:%s/ for Django." % (addr , port)562 print "Go to http://%s:%s/ for Django." % (addr or '127.0.0.1', port) 561 563 print "Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows)." 562 564 try: 563 565 run(addr, int(port), AdminMediaHandler(WSGIHandler()))
comment:3 by , 19 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Use runserver 0.0.0.0:8000 to make it listen on all interfaces
This is by design; you should have to explicitly reveal the server on external addresses if you know you want to -- otherwise inexperienced users could accidentally expose development servers.