Ticket #3357: threading.patch

File threading.patch, 2.1 KB (added by treborhudson@…, 9 years ago)
  • django/conf/global_settings.py

     
    113113EMAIL_HOST_USER = ''
    114114EMAIL_HOST_PASSWORD = ''
    115115
     116# Whether to use a multi-threaded development server.
     117USE_MULTITHREADED_SERVER = False
     118
    116119# List of strings representing installed apps.
    117120INSTALLED_APPS = ()
    118121
  • 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 django.conf import settings
     11from BaseHTTPServer import BaseHTTPRequestHandler
    1112from types import ListType, StringType
    1213import os, re, sys, time, urllib
    1314
     15if settings.USE_MULTITHREADED_SERVER:
     16    # This creates a base HTTPServer class that supports multithreading
     17    import BaseHTTPServer, SocketServer
     18    class HTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
     19        def __init__(self, server_address, RequestHandlerClass=None):
     20            BaseHTTPServer.HTTPServer.__init__(self, server_address, RequestHandlerClass)
     21else:
     22    from BaseHTTPServer import HTTPServer
     23
    1424__version__ = "0.1"
    1525__all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
    1626
  • docs/settings.txt

     
    856856set to ``False``, Django will make some optimizations so as not to load the
    857857internationalization machinery.
    858858
     859USE_MULTITHREADED_SERVER
     860------------------------
     861
     862Default: ``False``
     863
     864A boolean that specifies whether Django's built-in development server
     865should run multi-threaded.  Caution should be taken when setting this to
     866True so as to avoid multi-threading bugs in your views.
     867
    859868YEAR_MONTH_FORMAT
    860869-----------------
    861870
Back to Top