I have a Django project, and I'm somewhat of a newbie in it. I have the following PyUnit test trying to save an object into a PostgreSQL database:
import unittest
from foo.models import ObjectType
class DbTest(unittest.TestCase):
def testDBConnection(self):
object_type = ObjectType()
object_type.name = 'Test Object'
object_type.description = 'For testing purposes'
object_type.save()
And my database settings are like this:
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'FOO'
DATABASE_USER = 'username'
DATABASE_PASSWORD = 'password'
DATABASE_HOST = 'localhost'
DATABASE_PORT = '5432'
I ran python manage.py syncdb for my project, which worked successfully, so my database should be setup properly. However I get the following error when I try to run the above unit test:
File "C:\Python26\lib\site-packages\django\db\backends\dummy\base.py", line 15, in complain raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet." ImproperlyConfigured: You haven't set the DATABASE_ENGINE setting yet.
Has anyone ever had experience with a problem like this? If so, any advice on where to start? Thanks!