Environment: Intellij PyCharm, Python Django, Sqlite3
I use a standard Django setup project. I try to write some Unittests, but I run into the following error. After some research, I ended up here.
DB Config
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
Code of tests.py
from django.test import TestCase as djangoTestCase
import os
import unittest
# Create your tests here.
class TestExample(djangoTestCase):
def setUp(self):
print('setup')
print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def test_abc(self):
self.assertEqual(1,1)
def tearDown(self):
print('tearDown')
if __name__ == '__main__':
unittest.main()
This is the output
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
I tried to find the mistake by reading documentation, but without success. What could be the problem?