Opened 5 years ago

Closed 2 years ago

#14332 closed New feature (wontfix)

manage testserver and manage runserver should have similiar address:port options

Reported by: wildfire@… Owned by: fheinz
Component: Core (Management commands) Version: 1.2
Severity: Normal Keywords: runserver, testserver
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Hi,

$ ./manage.py runserver -h
Usage: ./manage.py runserver [options] [optional port number, or ipaddr:port]

Starts a lightweight Web server for development.

[...]

$ ./manage.py testserver -h
Usage: ./manage.py testserver [options] [fixture ...]

In order to get the testserver to listen on a particular port, you need to specify the --addrport option.

It would be useful if that option was also understood by the normal runserver command. Or if testserver interpreted a bare port number as the runserver command does.

Attachments (1)

uniform_addrport_handling.patch (6.7 KB) - added by fheinz 5 years ago.
This patch implements the requested feature

Download all attachments as: .zip

Change History (13)

comment:1 Changed 5 years ago by gabrielhurley

  • Component changed from Uncategorized to django-admin.py
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by fheinz

  • Owner changed from nobody to fheinz

Changed 5 years ago by fheinz

This patch implements the requested feature

comment:3 Changed 5 years ago by fheinz

  • Has patch set
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

The attached patch implements and documents the requested feature. For backwards compatibility, both runserver and testserver now accept both ways of specifying the IP address.

comment:4 Changed 5 years ago by fheinz

  • Resolution set to fixed
  • Status changed from assigned to closed

14332

comment:5 Changed 5 years ago by ramiro

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening. The fixed status is set when a commit lands in the code repository.

comment:6 Changed 5 years ago by lrekucki

  • Patch needs improvement set
  • Triage Stage changed from Accepted to Design decision needed

I'm against doing it this way. I see no value for having --addrport option for runserver. Duplicating functionality is a bad thing, imho (You know, "there should be one obvious way to do it", etc.). A minor backwards compatibility issue is that someone can have a fixture named "1000", which will now get interpreted as port number.

If I was to propose something, it would be deprectating --addrport and runserver's positional syntax in favour of --host and --port options. That would at least be consistent with most UNIX tools, but I'm generally -0 on changing anything here.

comment:7 Changed 5 years ago by fheinz

I agree that "there should be one obvious way to do it" is a Good Thing. What we have now is "there are two incompatible ways to do it, and you must choose the right one or it won't work".

The change you propose would give us indeed one way to do it, at the price of breaking backwards compatibility for *both* runserver and testserver.

I know that the current implementation doesn't work if you absolutely need to give a fixture a numerical name without extension, and put it first in the list of fixtures. That is an unlikely use case, and the --addrport option saves the day anyway.

The way I see it, of the three option that are on the table right now (providing a homogeneous interface that breaks backwards compatibility, providing a homogeneous but redundant user interface without breaking backwards compatibility, and leaving things as they are with an redundant and inconsistent interface), the patch implements the least objectionable one.

comment:8 Changed 4 years ago by graham_king

  • Keywords runserver testserver added
  • Severity set to Normal
  • Type set to New feature

comment:9 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:10 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:11 Changed 2 years ago by aaugustin

  • Status changed from reopened to new

comment:12 Changed 2 years ago by aaugustin

  • Resolution set to wontfix
  • Status changed from new to closed

runserver is about 10000x more used that testserver.

I'm -1 on making changes to runserver (especially changes towards a longer syntax) only to provide consistency with an obscure command few developers use.

I'm not very excited either by special casing the first argument to testserver to magically determine if it's a binding spec or a fixture name, such hacks backfire too often.

Please take it to django-developers to see if there's actual demand for changes, the current situation doesn't seem horrific to me. testserver needs arguments, runserver doesn't, that's it.

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