Ticket #19875: 19875.3.diff

File 19875.3.diff, 2.8 KB (added by Tim Graham, 11 years ago)
  • django/core/management/commands/runserver.py

    diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py
    index c4a0b78..ad90e19 100644
    a b class Command(BaseCommand):  
    8484        from django.conf import settings
    8585        from django.utils import translation
    8686
     87        if not settings.DEBUG and not settings.ALLOWED_HOSTS:
     88            self.stderr.write('You must set settings.ALLOWED_HOSTS if DEBUG is False.')
     89            sys.exit(1)
     90
    8791        threading = options.get('use_threading')
    8892        shutdown_message = options.get('shutdown_message', '')
    8993        quit_command = 'CTRL-BREAK' if sys.platform == 'win32' else 'CONTROL-C'
  • docs/intro/tutorial03.txt

    diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt
    index 1203691..6193ec4 100644
    a b template for all 404 errors when :setting:`DEBUG` is set to ``False`` (in your  
    473473settings module). If you do create the template, add at least some dummy
    474474content like "Page not found".
    475475
     476.. warning::
     477
     478    If :setting:`DEBUG` is set to ``False``, all responses will be
     479    "Bad Request (400)" unless you specify the proper :setting:`ALLOWED_HOSTS`
     480    as well (something like ``['localhost', '127.0.0.1']`` for
     481    local development).
     482
    476483A couple more things to note about 404 views:
    477484
    478485* If :setting:`DEBUG` is set to ``True`` (in your settings module) then your
  • docs/ref/settings.txt

    diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
    index ef52d31..897af27 100644
    a b It is also important to remember that when running with :setting:`DEBUG`  
    852852turned on, Django will remember every SQL query it executes. This is useful
    853853when you're debugging, but it'll rapidly consume memory on a production server.
    854854
     855Finally, if :setting:`DEBUG` is ``False``, you also need to properly set
     856the :setting:`ALLOWED_HOSTS` setting. Failing to do so will result in all
     857requests being returned as "Bad Request (400)".
     858
    855859.. _django/views/debug.py: https://github.com/django/django/blob/master/django/views/debug.py
    856860
    857861.. setting:: DEBUG_PROPAGATE_EXCEPTIONS
  • docs/topics/settings.txt

    diff --git a/docs/topics/settings.txt b/docs/topics/settings.txt
    index fa26297..1cfcd26 100644
    a b Here are a couple of example settings::  
    1717    DEFAULT_FROM_EMAIL = 'webmaster@example.com'
    1818    TEMPLATE_DIRS = ('/home/templates/mike', '/home/templates/john')
    1919
     20.. note::
     21
     22    If you set :setting:`DEBUG` to ``False``, you also need to properly set
     23    the :setting:`ALLOWED_HOSTS` setting.
     24
    2025Because a settings file is a Python module, the following apply:
    2126
    2227* It doesn't allow for Python syntax errors.
Back to Top