Ticket #3357: devserver_multithread_1.0.patch

File devserver_multithread_1.0.patch, 2.0 KB (added by onecreativenerd, 7 years ago)

Multithread patch for release 1.0

  • django/conf/global_settings.py

     
    140140EMAIL_HOST_PASSWORD = ''
    141141EMAIL_USE_TLS = False
    142142
     143# Whether to use a multi-threaded development server.
     144USE_MULTITHREADED_SERVER = False
     145
    143146# List of strings representing installed apps.
    144147INSTALLED_APPS = ()
    145148
  • 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
    1414import sys
    1515import urllib
    1616
     17from django.conf import settings
     18if settings.USE_MULTITHREADED_SERVER:
     19    # This creates a base HTTPServer class that supports multithreading
     20    import BaseHTTPServer, SocketServer
     21    class HTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
     22        def __init__(self, server_address, RequestHandlerClass=None):
     23            BaseHTTPServer.HTTPServer.__init__(self, server_address, RequestHandlerClass)
     24else:
     25    from BaseHTTPServer import HTTPServer
     26
    1727from django.utils.http import http_date
    1828
    1929__version__ = "0.1"
  • docs/ref/settings.txt

     
    11951195
    11961196.. setting:: YEAR_MONTH_FORMAT
    11971197
     1198USE_MULTITHREADED_SERVER
     1199------------------------
     1200
     1201**New in Django development version**
     1202
     1203Default: ``False``
     1204
     1205A boolean that specifies whether Django's built-in development server
     1206should run multi-threaded.  Caution should be taken when setting this to
     1207True so as to avoid multi-threading bugs in your views.
     1208
    11981209YEAR_MONTH_FORMAT
    11991210-----------------
    12001211
Back to Top