summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoayad Mardini <moayad.m@gmail.com>2014-05-20 16:27:12 +0300
committerTim Graham <timograham@gmail.com>2014-06-05 12:26:24 -0400
commit4f72e5f03ae803fd9faa1445245c1050ca004526 (patch)
treebba117a390279cd7e0f8958c184a2dff2d0d6573
parente560558ecb3a727c8f3f23e3a036413f8d8679eb (diff)
Fixed #21773 -- made daemon threads default in the development server.
Thanks clime for the report.
-rw-r--r--django/core/servers/basehttp.py8
-rw-r--r--docs/releases/1.8.txt2
2 files changed, 10 insertions, 0 deletions
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py
index 8b03e9bb4d..f93b3a3143 100644
--- a/django/core/servers/basehttp.py
+++ b/django/core/servers/basehttp.py
@@ -115,5 +115,13 @@ def run(addr, port, wsgi_handler, ipv6=False, threading=False):
else:
httpd_cls = WSGIServer
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
+ if threading:
+ # ThreadingMixIn.daemon_threads indicates how threads will behave on an
+ # abrupt shutdown; like quitting the server by the user or restarting
+ # by the auto-reloader. True means the server will not wait for thread
+ # termination before it quits. This will make auto-reloader faster
+ # and will prevent the need to kill the server manually if a thread
+ # isn't terminating correctly.
+ httpd.daemon_threads = True
httpd.set_app(wsgi_handler)
httpd.serve_forever()
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 30a5ab2239..087098b4ba 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -165,6 +165,8 @@ Management Commands
* The :djadminopt:`--ignorenonexistent` option of the :djadmin:`loaddata`
management command now ignores data for models that no longer exist.
+* :djadmin:`runserver` now uses daemon threads for faster reloading.
+
Models
^^^^^^