Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14928 closed (fixed)

manage runserver does not allow host name as address

Reported by: Karmel Allison Owned by: lrekucki
Component: django-admin.py runserver Version: 1.3-alpha
Severity: Keywords: blocker
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In Django 1.2, it was possible to use a host name (i.e., example.com) to run a Django server from manage.py:

python manage.py runserver example.com:8000

However, that convenience has been removed in Django 1.3-alpha. It looks like in order to add functionality for IPv6 addresses, a regex was added (r14711, line 12) that raises an error if non-IP-like addresses are used:

python manage.py runserver example.com:8000
Error: 'example.com:8000' is not a valid port numberor address:port pair.

The ability to run the server using host names was quite convenient, and preferable in many cases to having an IP specified. Would it be possible to re-enable that feature?

Thanks!

Attachments (3)

14928-1.diff (1.4 KB) - added by claudep 4 years ago.
Allow FQDN in addr part of runserver
14928.diff (4.3 KB) - added by lrekucki 4 years ago.
Alternative patch, that accepts ASCII hostnames.
14928-2.diff (6.4 KB) - added by claudep 4 years ago.
Patch of lregucki with basic tests

Download all attachments as: .zip

Change History (13)

comment:1 Changed 4 years ago by rasca

  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

I can confirm the behavior. Accepting the ticket.

This should be fixed before releasing 1.3.

comment:2 Changed 4 years ago by lrekucki

  • Owner changed from nobody to lrekucki

comment:3 Changed 4 years ago by jezdez

  • Triage Stage changed from Accepted to Design decision needed

Not really a regression since it was not only undocumented but also clearly defined as a IP:port pair

comment:4 Changed 4 years ago by russellm

  • Keywords blocker added

comment:5 Changed 4 years ago by claudep

I've also a use case where I need to provide a FQDN to runserver (handling of various subdomains in an app). I do not see the real advantage of using the regex instead of the simpler (r)split that was previously used. The addr part of the 'addr:port' sequence is my business, not Django's.

Changed 4 years ago by claudep

Allow FQDN in addr part of runserver

comment:6 Changed 4 years ago by claudep

  • Has patch set

comment:7 Changed 4 years ago by lrekucki

I used a regex, because I needed a simple way to distinguish between IPv4 and IPv6. I think splitting on ":" is confusing as it's also an IPv6 address separator. I also wanted to give the user more meaningful error messages.

Changed 4 years ago by lrekucki

Alternative patch, that accepts ASCII hostnames.

comment:8 Changed 4 years ago by jezdez

  • Triage Stage changed from Design decision needed to Ready for checkin

Yah, lrekuck's patch seems to work nicely.

Changed 4 years ago by claudep

Patch of lregucki with basic tests

comment:9 Changed 4 years ago by russellm

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

(In [15215]) Fixed #14928 -- Ensure that a fully qualified domain name can be used for runserver. Thanks to Karmel Allison for the report, Łukasz Rekucki for the patch, and claudep for the tests.

comment:10 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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