title: Overriding Settings for unit tests in Django doesn't work properly
body: <p>I tried to unit test my Django program and I would like to check several values for a few variables in my <code>settings.py</code> file.</p>
  
  <p>In the documentation, the section "<a href="https://docs.djangoproject.com/en/1.6/topics/testing/tools/#overriding-settings" rel="noreferrer">Overriding settings</a>" is describing a way to do it. But, despite all my attempts, I miserably fail to make the changes available in the program while the test is running. Here is a summary of what I do on a minimal example:</p>
  
  <p>First, create a new project:</p>
  
  <pre><code>$ pyvenv virtualenv
  $ cd virtualenv/
  $ . bin/activate
  (virtualenv) $ pip install django
  (virtualenv) $ django-admin startproject myapp
  (virtualenv) $ cd myapp/
  </code></pre>
  
  <p>Then, add the following files.</p>
  
  <h2>File <code>settings.py</code></h2>
  
  <pre><code>...
  
  TEST_VALUE = 'a'
  </code></pre>
  
  <h2>File <code>tests.py</code></h2>
  
  <pre><code>from django.test import TestCase
  from myapp.settings import TEST_VALUE
  
  class CheckSettings(TestCase):
  
    def test_settings(self):
      self.assertEqual(TEST_VALUE, 'a')
  
    def test_modified_settings(self):
      with self.settings(TEST_VALUE='b'):
        self.assertEqual(TEST_VALUE, 'b')
  </code></pre>
  
  <p>When I run the tests, I get the following:</p>
  
  <pre><code>$ ./manage.py test
  Creating test database for alias 'default'...
  F.
  ======================================================================
  FAIL: test_modified_settings (myapp.tests.CheckSettings)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/virtualenv/myapp/tests.py", line 12, in test_modified_settings
      self.assertEqual(TEST_VALUE, 'b')
  AssertionError: 'a' != 'b'
  ----------------------------------------------------------------------
  Ran 2 tests in 0.001s
  
  FAILED (failures=1)
  Destroying test database for alias 'default'...
  </code></pre>
  
  <p>As you may have noticed, the original value of <code>TEST_VALUE</code> is <code>'a'</code>, and I try to modify it through the <code>self.settings(TEST_VALUE='b')</code>... but, without success. </p>
  
  <p>You may try it through an empty project (Django is 1.6.5).</p>
  
  <p>So, what am I missing to get it work properly ?</p>