Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#360 closed defect (fixed)

[PATCH] django-admin.py runserver only takes a port when it could also take an ip:port

Reported by: benno@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently django-admin.py's runserver command can only take a port number and will always use 127.0.0.1 as the bind address. This patch allows an IP address to be specified by passing <ip address>:<port> instead of just <port>.

Attachments (4)

django-server-addr.diff (2.5 KB ) - added by benno@… 19 years ago.
Patch to add ip:port as well as port argument to runserver.
django-server-addr.2.diff (2.7 KB ) - added by benno@… 19 years ago.
Fixed version (fixes up empty addr string)
dj360_539.diff (0 bytes ) - added by fonso 19 years ago.
Don't explicitly specify the binding address for the server
dj360_539.2.diff (546 bytes ) - added by fonso 19 years ago.
Don't explicitly specify the binding address for the server (second try)

Download all attachments as: .zip

Change History (10)

by benno@…, 19 years ago

Attachment: django-server-addr.diff added

Patch to add ip:port as well as port argument to runserver.

by benno@…, 19 years ago

Attachment: django-server-addr.2.diff added

Fixed version (fixes up empty addr string)

comment:1 by Adrian Holovaty, 19 years ago

Thanks for this patch.

Before we roll it in, I have a question: What's the use-case for this? Why would somebody need to run the development server (which should NOT be run on a production site) on a separate IP address?

comment:2 by Simon Willison, 19 years ago

Here's a use case: you are running the development server on a machine which has a public internet facing IP address and another address that is only visible to your network. You would want the development server to face internally only. This isn't that unlikely in a small development shop where the dev box might double up as the office router.

comment:3 by Adrian Holovaty, 19 years ago

Status: newassigned

comment:4 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: assignedclosed

(In [539]) Fixed #360 -- runserver now takes optional 'ip:port' in addition to 'port'. Thanks, benno@…

comment:5 by fonso, 19 years ago

In my case, this patch makes the the server refuse remote connections if I don't explicitly indicate the public interface IP. E.g., I have to use:

$ django-admin.py runserver 192.168.1.4:8000

Changing line 550 in core/management.py (http://code.djangoproject.com/file/django/trunk/django/core/management.py?rev=539) to just addr = '' fixes this.

by fonso, 19 years ago

Attachment: dj360_539.diff added

Don't explicitly specify the binding address for the server

by fonso, 19 years ago

Attachment: dj360_539.2.diff added

Don't explicitly specify the binding address for the server (second try)

comment:6 by rff_rff@…, 18 years ago

another use case: I'm developing on a virtual machine with a minimal installation and connecting from my real one to test. I applied the same change as in dj360_539.2.diff by myself, because it is so much easier to work that way.

Note: See TracTickets for help on using tickets.
Back to Top