Opened 14 years ago
Closed 12 years ago
#16049 closed New feature (duplicate)
Make runserver reuse listening socket
Reported by: | Wil Tan | Owned by: | anonymous |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Jannis Leidel, bhuztez@…, deprince@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When using autoreload mode of runserver, there is a small window of time between restarts that the port is not bound. This disrupts the workflow because one has to wait for the server to come back up before being able to reload the browser to see code changes reflected.
We can reuse the listening socket's file descriptor by having the parent create the socket, and passing it to the child (where the real web server is run.)
A proof-of-concept is available on https://github.com/wil/django-pserver
Change History (11)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
I like the idea but am not sure what the side effects could be, e.g. sockets that are kept open when the server crashes.
comment:3 by , 14 years ago
Currently when server crashes, we'll have to Ctrl-C to kill the entire process anyway right? It should behave the same way, when the server starts up and crashes, there's not much we can do about it. except to kill it. I agree though, that we should be aware of side effects, can't say I've thought it through. Hopefully we can get some feedback from users of django-pserver.
comment:4 by , 14 years ago
Windows users don't have socked.fromfd() method which is used in the version of django-pserver. - ed
follow-up: 7 comment:5 by , 14 years ago
Yeah I was planning to specifically test for win32, use hasattr(socket, "fromfd")
or try-except, then disable the function accordingly. Ugly, but I can't think of a better way.
comment:7 by , 13 years ago
Replying to dready:
Yeah I was planning to specifically test for win32, use
hasattr(socket, "fromfd")
or try-except, then disable the function accordingly. Ugly, but I can't think of a better way.
Python 3 do have socket.fromfd on Windows. Ridiculously, Issue 1378 got closed without patch actually applied to Python 2. I guess it is better fixed in Python.
comment:8 by , 13 years ago
Cc: | added |
---|
comment:9 by , 12 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Is there any objection to making this django feature contingent upon http://bugs.python.org/issue1378 for our windows users?
comment:10 by , 12 years ago
I'm closing this ticket in favor of #18855 which has a good-looking patch.
comment:11 by , 12 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
patch coming up..