title: python running test: ImproperlyConfigured
body: <p>I'm trying to run some testes for django (1.7) project.</p>
  
  <p>have created a <code>test_models.py</code>  directory <code>/tests/</code> under project directory.</p>
  
  <p>On running test</p>
  
  <pre><code>&gt;&gt; python tests/test_models.py -v
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
  </code></pre>
  
  <p>Although
  following django stanards commands works fine</p>
  
  <pre><code>&gt;&gt; python manage.py runserver
  &gt;&gt; python manage.py shell
  </code></pre>
  
  <p><strong>test_models.py</strong></p>
  
  <pre><code>import unittest
  from django.contrib.auth.models import User
  from accounts.models import school
  
  class TestAccounts(unittest.TestCase):
  
      def setUp(self):
          admin_user = User.objects.get_or_create(
              username="testuser", password=111)
          self.admin = admin_user[0]
  
          self.school_name = "merucabs"
          self.email = "info@merucabs.com"
  
      def test_school(self):
          print "Testing school ..."
          school = School(name=self.school_name)
          school.created_by = self.admin
          school.updated_by = self.admin
          school.save()
          self.school = school
          self.assertEqual(self.school.name, self.school_name)
  
  
  
  def suite():
      suite = unittest.TestSuite()
      suite.addTests(unittest.makeSuite(TestAccounts))
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>