Django

Code

Ticket #360 (closed: fixed)

Opened 3 years ago

Last modified 1 year ago

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

Reported by: benno@jeamland.net Assigned to: adrian
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

django-server-addr.diff (2.5 kB) - added by benno@jeamland.net on 08/18/05 07:23:32.
Patch to add ip:port as well as port argument to runserver.
django-server-addr.2.diff (2.7 kB) - added by benno@jeamland.net on 08/18/05 07:26:30.
Fixed version (fixes up empty addr string)
dj360_539.diff (0 bytes) - added by fonso on 08/22/05 04:30:27.
Don't explicitly specify the binding address for the server
dj360_539.2.diff (0.5 kB) - added by fonso on 08/22/05 04:34:10.
Don't explicitly specify the binding address for the server (second try)

Change History

08/18/05 07:23:32 changed by benno@jeamland.net

  • attachment django-server-addr.diff added.

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

08/18/05 07:26:30 changed by benno@jeamland.net

  • attachment django-server-addr.2.diff added.

Fixed version (fixes up empty addr string)

08/18/05 09:34:33 changed by adrian

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?

08/18/05 10:35:26 changed by Simon Willison

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.

08/19/05 15:27:26 changed by adrian

  • status changed from new to assigned.

08/19/05 16:23:58 changed by adrian

  • status changed from assigned to closed.
  • resolution set to fixed.

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

08/22/05 04:22:36 changed by fonso

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.

08/22/05 04:30:27 changed by fonso

  • attachment dj360_539.diff added.

Don't explicitly specify the binding address for the server

08/22/05 04:34:10 changed by fonso

  • attachment dj360_539.2.diff added.

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

03/06/07 03:03:51 changed by rff_rff@yahoo.it

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.


Add/Change #360 ([PATCH] django-admin.py runserver only takes a port when it could also take an ip:port)




Change Properties
Action