Ticket #3357: devserver_multithread_trunk_r9532.patch

File devserver_multithread_trunk_r9532.patch, 2.0 KB (added by Ryan Witt, 16 years ago)

Multithreaded devserver patch for 1.0.1, 1.0.2 and trunk r9532

  • django/conf/global_settings.py

     
    142142EMAIL_HOST_PASSWORD = ''
    143143EMAIL_USE_TLS = False
    144144
     145# Whether to use a multi-threaded development server.
     146USE_MULTITHREADED_SERVER = False
     147
    145148# List of strings representing installed apps.
    146149INSTALLED_APPS = ()
    147150
  • django/core/servers/basehttp.py

     
    77been reviewed for security issues. Don't use it for production use.
    88"""
    99
    10 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
     10from BaseHTTPServer import BaseHTTPRequestHandler
    1111import mimetypes
    1212import os
    1313import re
     
    1515import sys
    1616import urllib
    1717
     18from django.conf import settings
     19if settings.USE_MULTITHREADED_SERVER:
     20    # This creates a base HTTPServer class that supports multithreading
     21    import BaseHTTPServer, SocketServer
     22    class HTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
     23        def __init__(self, server_address, RequestHandlerClass=None):
     24            BaseHTTPServer.HTTPServer.__init__(self, server_address, RequestHandlerClass)
     25else:
     26    from BaseHTTPServer import HTTPServer
     27
    1828from django.utils.http import http_date
    1929
    2030__version__ = "0.1"
  • docs/ref/settings.txt

     
    12031203
    12041204.. setting:: YEAR_MONTH_FORMAT
    12051205
     1206USE_MULTITHREADED_SERVER
     1207------------------------
     1208
     1209**New in Django development version**
     1210
     1211Default: ``False``
     1212
     1213A boolean that specifies whether Django's built-in development server
     1214should run multi-threaded.  Caution should be taken when setting this to
     1215True so as to avoid multi-threading bugs in your views.
     1216
    12061217YEAR_MONTH_FORMAT
    12071218-----------------
    12081219
Back to Top